Repeaters: Enable/Disable Sections in Repeaters with a Yes/No Trigger Question

Body

When you have controls in a repeater section that needs to be enabled based on a Yes/No question preceding it:

/*Main rule based on trigger question named Trigger_Name having value options: 
Yes=something & No=something else*/
if (Trigger_Name.value == 'Yes'){
 
  //covers when the green plus sign is clicked to repeat the section
  if (Repeater_Name.itemAdded){
    i = Repeater_Name.itemIndex;
    Section_Name[i].enabled = true;
    Crtrl_NameA[i].required = true;
    Crtrl_NameB[i].required = true;
  } else {
 
    //covers what already exists (aka: no item added
    for (var i=0; i < Crtrl_NameA.value.length; i++){
 
    Section_Name[i].enabled = true;
    Crtrl_NameA[i].required = true;
    Crtrl_NameB[i].required = true;
    }
  }
} else {
  //if Yes is not selected
  for (var i=0; i < Crtrl_NameA.value.length; i++){
  Section_Name[i].enabled = false;
  Crtrl_NameA[i].required = false;
  Crtrl_NameB[i].required = false;
 
  Section_Name[i].value = null;
  Crtrl_NameB[i].value = null;
  Crtrl_NameC[i].value = null;
   
  }
}

Details

Details

Article ID: 51452
Created
Tue 4/3/18 4:19 PM
Modified
Mon 4/16/18 5:04 PM