Copy link to clipboard
Copied
I am trying to create a document that if a radio button is selected it makes three following text boxes next to it required (there are three radio buttons with their own three text boxes linked to them).
I was able to get the formula to work where if a radio buttonis required, the textboxes linked to it are required. The problem I am having is one of the radio buttons is always selected. If I use "Clear Form" the button may not be selected by the textboxes linked to the button that was previsouly selected is still showing as being required to fill out as if the radio button was still selected.
The problem with this is when we send the form out, even if a client selects a new radio button the text boxes that are required are the ones linked to the radio button that was previously selected when the form was sent to fill out.
The formula I used for each radio button is:
if (event.target.value == "Choice1") {
this.getField("Card Number 1").required = true;
this.getField("Security Code 1").required= true;
this.getField("Expiration Date 1").required= true;
this.getField("Card Number 2").required = false;
this.getField("Security Code 2").required= false;
this.getField("Expiration Date 2").required= false;
this.getField("Card Number 3").required = false;
this.getField("Security Code 3").required= false;
this.getField("Expiration Date 3").required= false;
}
Copy link to clipboard
Copied
When you reset the form you must set also required to false.
Copy link to clipboard
Copied
That's the problem when using a Mouse Up event for such things, as it doesn't get triggered when the file is cleared.
I would recommend moving the code to be the custom calculation script of a (hidden) text field, instead.