1 Reply Latest reply on Aug 1, 2017 2:52 PM by try67

    Un-check box, un-requre field

    DC002

      I wrote the following JavaScript that runs when a customer "MouseUp" (clicks) a radio box. It requires them to fill out a field when the "yes" box is checked:

       

      f="Explanation";

      e="Yes: custom design";

      tField=this.getField(f);

      if(event.target.value==e){tField.required=true;}else{tField.required=false;}

       

      "f" is the field in which the customer types their explanation, and "e" is the "yes" checkbox. The script is run through the "properties" of the "yes" check box.

       

      My issue is that there is also a "no" box as part of the radio family. So, when the "no" box is clicked it "un-clicks" the "yes" box. Unfortunately, this does not "un-require" the explanation field. Can someone suggest an edit to my JavaScript to make this happen?

       

      (I apologize if my explanations are poorly worded. I am very new to JavaScript)