Using "OR" with DFFS rules

Forums Dynamic Forms for SharePoint Using "OR" with DFFS rules

Viewing 3 reply threads
  • Author
    Posts
    • #7526
      Matthew Whittle
      Participant

      I have a need to hide fields if either checkbox ‘a’ or ‘b’ are checked.
      How can I accomplish this with DFFS? or javascript API call, so on?

    • #7563
      Alexander Bautz
      Keymaster

      Hi,
      Is this two options in a multichoice checkbox, or two separate yes/no fields?

      Alexander

    • #7571
      Matthew Whittle
      Participant

      Current design is two separate fields.

      Example:
      Field 1) 5307 compliant? (yes/no)
      Field 2) 5311 compliant? (yes/no)

      If either 5307 or 5311 is yes
      Then show tab
      Else hide tab
      ——————–
      In this specific case, perhaps I could use a choice field along with {contains} in a DFFS rule. But elsewhere I’ve got potential uses for an [OR] DFFS rule solution, and finally got around to asking here about it.

    • #7619
      Alexander Bautz
      Keymaster

      Hi,
      Sorry for the delay. I will look into adding support for “OR these rules = true” in the trigger area to be able to support such a scenario.

      Here is a little code snippet you may use in the meantime – add it to the custom js area:

      // Onclick
      $("#dffs__x0035_307Compliant, #dffs__x0035_311Compliant").find("input:checkbox").bind("click",function(){
      	customShowHideTab();
      });
      
      function customShowHideTab(){
      	var a = getFieldValue("_x0035_307Compliant");
      	var b = getFieldValue("_x0035_311Compliant");
      	if(a||b){
      		$("#dffs_tab_1").show();
      	}else{
      		$("#dffs_tab_1").hide();
      	}
      }
      
      // On load
      customShowHideTab();

      Change “_x0035_307Compliant” and “_x0035_311Compliant” for your field names, and change “dffs_tab_1” to match the index (0-based) of the tab you want to toggle.

      Alexander

Viewing 3 reply threads
  • You must be logged in to reply to this topic.