Custom JS [ Show Hide Fields ]

Forums Classic DFFS Custom JS [ Show Hide Fields ]

Viewing 2 reply threads
  • Author
    Posts
    • #8513
      Drew Heggie
      Participant

      I’m writing some Custom JS to Show/ Hide some fields on the form based on the iput values from another field. Although this can typically be done via the Rules tab the situation I am dealing with is quite complex so requires some JS. What is the syntax for Show/ Hide?

      i.e. we have:-
      spjs.dffs.flag_Mandatory
      spjs.dffs.clear_Mandatory
      to toggle Mandatory on off. Is there something similar for Show/ Hide?

    • #8526
      Alexander Bautz
      Keymaster

      You can use a “normal” jQuery selector like this:

      // hide
      $("#dffs_FieldInternalName").hide();
      // show
      $("#dffs_FieldInternalName").show();

      Change “FieldInternalName” for your fields name.

      There are “internal” functions to do this also, but these are linked together with tabs and rules, and this basic approach might be better.

      Let me know how it works out.

      Alexander

    • #8540
      Drew Heggie
      Participant

      Perfect. Thanks again 😎
      While I’m here: Do you have a list of available commands that can be executed via Custom JS? E.g.
      Set field value to…
      Set Field to Read Only
      Alert message…
      Basically the commands available through the Rules Tab.

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