Hiding elements in a Repeat Group

eugenecjr

Member
I am trying to hide an element in a repeat group. The issue that I am having is that I only want to hide this element when a drop down has a value of 6 and is not the first record in the repeat group. I have no issues hiding elements based on values but am running into an issue figuring out how to hide on any records that are not the first record.

I appreciate any assistance with this.

-Eugene
 
Lousyfool,

That is what I usually do, I think I am getting caught up on the syntax needed for working with the repeat groups. Such as getting values and hiding elements.
 
I have looked at and tried to derive the proper coding to be able to hide elements in the repeat group. The Wiki referenced above only shows pulling all records for an element in the the repeat group. I understand how this is likely more complicated since the report group is showing more then one record at a time. A little more direction would be greatly appreciated.
 
Like with most code examples in the Wiki, it is just that: an example.
You see that you can get all occurrences of an element across the repeat subgroups as an array, by name as per Wiki example, or by ID, etc.
Then you'll probably want to loop through the array and, if certain conditions are matched, do what you need to do.
Don't forget, you can always "console.log()" to see what you're having.
 
lousyfool,

I am circling back to this as it seems that databasejoin element does not work when setting an change event for Javascript. I prefer to put my work in form_x.js due to being easier to troubleshoot but am shooting in the dark when it comes to getting this going. I have put together the following code but I am not able to get it to work as expected.

JavaScript:
function HideElements(el) {
    var orderNumber = el.form.formElements.get('fab_trade_tracker_activity___order_number');
    var serialNumber = el.form.formElements.get('fab_trade_tracker_activity___serial_number');

   document.getElements("input[name^=fab_trade_tracker_activity___redemption_type]").each(function(el)
   {
      var group_suffix = '';
      if (el.id.test(/redemption_type_(d+)/)) {
         group_suffix = '_' + el.id.match(/redemption_type_(d+)/)[1];
      }
      switch ($('fab_trade_tracker_activity___redemption_type' + group_suffix).value) {
         case 'Gift Certificate':
            orderNumber.hide();
            serialNumber.show();
            break;
         case 'Order':
            orderNumber.show();
            serialNumber.hide();
            break;
         case '':
            orderNumber.hide();
            serialNumber.hide();
            break;
        }
   })
}

Being this is my first time going about this any pointers would be much apprecated.

-Eugene
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top