0 Replies Latest reply on Nov 3, 2016 7:36 AM by kyleb90859659

    Required Field if another Field is Filled in.

    kyleb90859659

      Below is my current script.  However only one field need to be filled out for AVG.  So when first filling out the text box I want to require all the blow fields but if text is put in to AVG.1 the JANAVG1 is not required and vise versa. If text entered into JANAVG.1 then AVG.1 is not required.

       

      if (event.target.value != "") {

          this.getField("BNT.1").required = true;

          this.getField("BIDT.1").required = true;

          this.getField("AVG.1").required = true;

          this.getField("JANAVG.1").required = true;

          }

       

       

      if (event.target.value == "") {

          this.getField("BNT.1").required = false;

          this.getField("BIDT.1").required = false;

          this.getField("AVG.1").required = false;

          this.getField("JANAVG.1").required = false;

          }

       

      I attempted adding the below to the text field of the AVG.1 and JANAVG.1 however when clearing the form these below commands keep the AVG.1 and JANAVG.1 as required when they are not.

       

      On the AVG.1

      if (event.target.value != "") {

          this.getField("JANAVG.1").required = false;

          }

       

      if (event.target.value == "") {

          this.getField("JANAVG.1").required = true;

          }

       

      On the JANAVG.1

      if (event.target.value != "") {

          this.getField("AVG.1").required = false;

          }

       

       

      if (event.target.value == "") {

          this.getField("AVG.1").required = true;

          }

       

       

      So any help would be great.  I figure the best plan of action is including and either or on the first group of commands but don't know how to do it.