Copy link to clipboard
Copied
Hello,
I have a list of checkboxes (1-11) with Mouse Up script that unchecks Checkbox 12 if any of the checkboxes 1-11 are selected. If no checkboxes 1-11 are selected, then checkbox 12 is automatically checked. I have seen some refer to this as a toggle. See the following script:
var bChecked = (event.target.value == "Yes")
this.getField("Check Box12").value = bChecked?"Off":"Yes";
I have also set checkbox 12 as the default. So when a user opens the form, checkbox 12 will be checked unless they tick one of the boxes 1-11.
This works great, however, there is a text box that I would like to be required if checkbox 12 is checked. I believe the trouble I am having may be the result of the "toggle" function. Since there is no mouse function (up, down, enter, exit, on focus, or on blur) associated with the checking of box 12, I cannot seem to use script in the properties of the checkbox
Is there a custom calculation script that I can use for the text field to achieve my goal? Or any other options to make this possible?
Thanks for any suggestions!
Yes, as custom calculation of that text field use this:
event.target.required = this.getField("checkbox 12").value == "Off" ? false : true;
Copy link to clipboard
Copied
Yes, as custom calculation of that text field use this:
event.target.required = this.getField("checkbox 12").value == "Off" ? false : true;
Copy link to clipboard
Copied
Brilliant! Thanks!