JS that utilizes the “Group ID” functionality?

Forums Classic DFFS JS that utilizes the “Group ID” functionality?

Viewing 6 reply threads
  • Author
    Posts
    • #35884
      Jon Whisman
      Participant

      We have forms that use pure JS – no rules in dffs back-end.

      I would like to leverage the Group ID functionality to bulk control groups of fields / headers, etc. in the form (hide this group, show that group, read only this group, etc.)

      Is there SPJS syntax to utilize the group IDs?

      EG:

      //un-hide fields
      spjs.dffs.unhideFieldsByRule([
      TabGroup_xxx
      ]);

    • #35886
      Alexander Bautz
      Keymaster

      The fields in the tabgroup can be found as an array in this object:

      spjs.dffs.data.dffsDataObj.data.groupToFin
      

      This means you can loop over the fields in a group like this:

      jQuery.each(spjs.dffs.data.dffsDataObj.data.groupToFin.YOUR_GROUP_NAME, function(i, fin){
          // do something with fin here
      });
      

      Alexander

    • #35892
      Jon Whisman
      Participant

      AWESOME! THANK YOU, Alexander!

    • #37602
      Bryan Waldrop
      Participant

      What would showing fin look like?

      • #37603
        Alexander Bautz
        Keymaster

        Not sure I understand what you mean by showing fin – do you mean in code identify the fin, or using code to show the corresponding field in the form?

        Alexander

    • #37604
      Bryan Waldrop
      Participant

      I am familiar the following custom js for working with a single column but I seem to be missing some syntax for the group id method above for group ID:

      $(“#dffs_FieldInternalName”).hide();
      $(“#dffs_FieldInternalName”).show();
      spjs.dffs.flag_Mandatory([“FieldInternalName”]);
      spjs.dffs.clear_Mandatory([“FieldInternalName”]);
      spjs.dffs.doReadOnly([“FieldInternalName”]);

    • #37605
      Alexander Bautz
      Keymaster

      You must use the fin variable in the loop like this:

      jQuery.each(spjs.dffs.data.dffsDataObj.data.groupToFin.YOUR_GROUP_NAME, function(i, fin){
          // do something with fin here
          console.log(fin);
          jQuery("#dffs_" + fin).hide();
          spjs.dffs.flag_Mandatory([fin]);
      });
      

      Alexander

    • #37606
      Bryan Waldrop
      Participant

      Perfect and thank you! Putting money in the piggy bank!

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