9 Replies Latest reply on Feb 13, 2014 5:38 PM by berocca

    Making fields "required" using if statement

    Rich_Henderson Level 1

      Hi,

       

      This maybe really trivial for someone, but I am trying to make a text field 1 become a required field if someone ticks checkbox 1. This is how far I have got:

       

      var one = this.getField("Check Box 1");

      var two = this.getField("Text Box 1");

      if (one.value == "True") { two.mandatory = "error" } else {two.mandatory = "disabled"};

       

      I have entered this as a mouse up action in the check box. There are no errors when I have done this, but it doesn't make the field become a mandatory field.

       

      Also; would this be a similar script if I wanted to make the field visable/hidden with a check box using .presence = "hidden"/.presence = "visible"?

       

      Any and all help appreciated!