Show/hide group with js

bea

Active Member
Hi again,
forget the old post, because there is a new situation:

I've 4 elements:
elB = fab_cp1_line_tour___security_status (dropdown, value 1,2 and 3 | 3= show group)
elC = fab_cp1_line_tour___security_checks (checkboxes, value 1,2,3 and 4 | minimum one not checked=show group)
elD = fab_cp1_line_tour___security_incidents (int field | >=1 show group)
elE = fab_cp1_line_tour___security_nearmiss (int field | >=1 show group)

Group 9 with one element is hidden by default.
The script doesn't work, because I did it wrong...

Many thanks in advance.
Bianka


JavaScript:
function hidecomment_sec(el){
   var form = Fabrik.getBlock('form_1');
   if (form === false) {
      form = Fabrik.getBlock('details_1');
   }

  if (form === false) {
    return;
   }

   var elA = el.form.formElements.get('fab_cp1_line_tour___security_comment');
   var elB = el.form.formElements.get('fab_cp1_line_tour___security_status');
   var elC = el.form.formElements.get('fab_cp1_line_tour___security_checks');
   var elD = el.form.formElements.get('fab_cp1_line_tour___security_incidents');
   var elE = el.form.formElements.get('fab_cp1_line_tour___security_nearmiss');

   if((elB.getValue().toInt()=='3')
          ||
        (elC.getValue().toInt()!='["1","2","3","4"]')
        ||
        (elD.getValue().toInt()>='1')
        ||
        (elE.getValue().toInt()>='1')
        ){
      jQuery('#group9').show();
     return;
   }

     if((elB.getValue().toInt()<'3')
         ||
        (elC.getValue().toInt()=='["1","2","3","4"]')
        ||
        (elD.getValue().toInt()<'1')
        ||
        (elE.getValue().toInt()<'1')
    
        ){
      jQuery('#group9').hide();
      return;
   }
   else{
      jQuery('#group9').hide();
   }
}
 
Last edited:
Hi,
without Element C (checkbox) the script works inside the form, but not detailed.
Would be nice to get a hint ;)
Cheers
Bianka
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top