I am using this script
this.getField("cust Tel No").required = !event.target.isBoxChecked(0);
and it works but when i try and add extra text boxes it doesnt, where am i going wrong
this.getField("cust Tel No").required = !event.target.isBoxChecked(0); &&
this.getField("cust Tel Ar").required = !event.target.isBoxChecked(0);
Copy link to clipboard
Drop the "&&" at the end of the first line.
I have 3 radio buttons, when i use the same script on the second radio button it doesn't work, any reason why and on the third radio button i don't want the text boxes to be required so how do i cancel the required?
Please describe how you want this to work, exactly.
I have 3 radio buttons and 4 text field that need to be completed if either the first or second radio button is checked. If the 3rd radio button is checked then i dont want these text boxes to be required. The radio buttons are choice 1, choice2 and choice 3, choice 3 being the button canceling the text boxes being required
What's the name of the radio-button group?
Also, what should happen if no radio button in the group is selected at all?
the radio group is required, there has to be one of the radios checked
I didn't follow what you meant, and the fact the field is required doesn't mean it will always have a selected value, which you have to take into consideration when writing the script.
I want to put at the end of the form a script that will ensure all required fields are completed before the form can be signed, however I am not there yet so am leaving that for another day
Well, you can use this code as the custom calculation script of a (hidden) text field to achieve it:
var v = this.getField("Group19").valueAsString;
var b = (v=="Choice 1" || v=="Choice 2");
this.getField("cust Tel No").required = b;
this.getField("cust Tel Ar").required = b; // etc.
fantastic thank you
its called Group19, but i just figured out to change the 0 to 1 for the second button so now i just need to know how to cancel the text box being required