4 Replies Latest reply on Apr 15, 2011 1:21 PM by DC Dowd

    Conditionally Required Fields

    DC Dowd

      Basics -

      Running LC ES 8.2 and Acrobat 9 Pro

      Novice/Beginner in JavaScripting as a whole, especially as pertains to PDFs

       

      Situation -
      Trying to set up a form wherein a field is required if one option from a combo box is selected and to either be optional or removed otherwise.

      I've been trying "if ... else" statements without any luck. The field (AbortRchgSA/#8) is set as Visible and not required by default. The combo box (Mode/#16) is a required field. My attempts have taken two forms.

       

      Form 1:

      var f = this.getField("Mode").value;

      if (f = SA)

      {var g = this.getField("AbortRchgSA");

      g.required = true;}

       

      Form 2:

       

      if (this.Field.Mode.value == SA)

       

      this.getField(“AbortRchgSA”) = required;

       

      else

       

      this.removeField(“AbortRchgSA”);

       

       

      Any and all help is welcome.