Moved: Trigger rule based on value in 3 different fields

Home Forums Classic DFFS Moved: Trigger rule based on value in 3 different fields

Viewing 1 reply thread
  • Author
    Posts
    • #12508
      Vernon Brooks
      Participant

        Ahhhh!! I’m going crazy, lol. I’m trying to display different tabs in a form, based on the various results of 3 different fields(columns). . . e.g. “If FieldA = Blue and if FieldB = white and if FieldC=Red, then dislay the Tab, “BlueWhiteRed”

        How do I compare the 3 fields like I do when I can compare 3 rules in the “And these rules or functions = true / false”?

        Do I have to first create a unique field and an associated unique rule for each possible selection, then use the “. . . rules or functions = true / false” to trigger the needed tab? That would be comparing 3 rules vs 3 fields. Is there an easier way to compare 3 fields that create a trigger for a tab?

        Big thanks!

      • #12528
        Alexander Bautz
        Keymaster

          Hi,
          You can set this up with multiple rules, but it’s best solved with some custom code. Add this to your Custom JS section:

          function showSalesSupportTabs(){
              var requestCategory = getFieldValue("RequestCategory");
              var salesSupportCategory = getFieldValue("SalesSupportCategory");
              var resourceType = getFieldValue("ResourceType");
              if(requestCategory === "1. Sales Support" && salesSupportCategory === "ROM/RFI" && resourceType === "Project Engeneer"){
                  spjs.dffs.toggleVisibleTab("YourTabName",true);
              }else{
                  spjs.dffs.toggleVisibleTab("YourTabName",false);
              }
          }
          
          // Change event on dropdown
          spjs.$("#dffs_RequestCategory").on("change",function(){
              showSalesSupportTabs();
          });
          
          // Change event on radio buttons
          spjs.$("#dffs_SalesSupportCategory, #dffs_ResourceType").on("click",function(){
              showSalesSupportTabs();
          });

          You must change the internal names for the fields “RequestCategory”, “SalesSupportCategory” and “ResourceType” – you find them in the tab “Field table” in DFFS backend. You must also change the tab name from “YourTabName” to whatever “Tab unique ID” you name used.

          To add more “if’s” just add copy the contents of then function “showSalesSupportTabs” and add a new section to this function where you change the field names and tab name.

          Let me know how this works out.

          Alexander

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.