1
0
-1

Is there any way to use javascript to see if a field is currently visible on the form in Maestro?

 

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      I got this working using:

      Form.isVisible("textField", data)

      or alternately:

      Form.isVisible(getItemFromPath("data.textField"), data)

      The second method is probably the safest, as the string passed in the first method won't refactor if the textField ID changes.

        CommentAdd your comment...
      1.  
        1
        0
        -1

        You can use:

        var item = Form.items["canISeeThis"],
          isVisible = Rules["sh_" + item.id](data, item);

         

        We will make a more convenient helper method for this.

        1. Tim Stewart

          OK I've added a convenience method for this, which also goes through and checks visibility on all ancestors too. It is: Form.isVisible(itemOrId, data) And will be available as of Maestro 5.0.18.

        2. Chris Reid

          How do we call this rule Tim? What do we pass for itemOrId? Is this just a reference to the form object, the same way we'd reference the value? And do we just pass the 'data' object as the second parameter? I'm currently calling this using: Form.isVisible(data.textField, data) I get an error in the console: Cannot read property '$$parent' of undefined

        CommentAdd your comment...