Copy link to clipboard
Copied
Hello,
I've looked through many posts on this topic and have found some solutions, but one thing is not functioning correctly. I have a Yes/No checkbox, and A/B/C checkboxes that I want to be disabled unless Yes is checked:
It was working, but what was happening was that the Yes button was enabling the boxes only if the No button had been clicked to check OFF, but not if the Yes button was clicked, toggling the ON No button (No button had to be checked OFF for the Yes button to enable the fields).
Unfortunately, I can't recreate the state noted above, so I didn't want to post the script, but I could if needed to help.
Thanks in advance!
Copy link to clipboard
Copied
There many ways to do this with JavaScript scripting.
In my example below I named the checkboxes for yes and no with the same field name "myCheckBox" and then I set them up each one with a different export value for example: "Choice1", and "Choice2" respectively.
For the 3 checkboxes A, B, and C I created them and named them as shown in the scripts below and also set their field property to read-only (as default):
if (event.target.valueAsString == "Choice1") {
this.getField("A").readonly = false;
this.getField("B").readonly = false;
this.getField("C").readonly = false;
} else {
this.getField("A").readonly = true;
this.getField("B").readonly = true;
this.getField("C").readonly = true;
}
this.getField("A").readonly = true;
this.resetForm(["A"]);
this.getField("B").readonly = true;
this.resetForm(["B"]);
this.getField("C").readonly = true;
this.resetForm(["C"]);
Copy link to clipboard
Copied
There many ways to do this with JavaScript scripting.
In my example below I named the checkboxes for yes and no with the same field name "myCheckBox" and then I set them up each one with a different export value for example: "Choice1", and "Choice2" respectively.
For the 3 checkboxes A, B, and C I created them and named them as shown in the scripts below and also set their field property to read-only (as default):
if (event.target.valueAsString == "Choice1") {
this.getField("A").readonly = false;
this.getField("B").readonly = false;
this.getField("C").readonly = false;
} else {
this.getField("A").readonly = true;
this.getField("B").readonly = true;
this.getField("C").readonly = true;
}
this.getField("A").readonly = true;
this.resetForm(["A"]);
this.getField("B").readonly = true;
this.resetForm(["B"]);
this.getField("C").readonly = true;
this.resetForm(["C"]);
Copy link to clipboard
Copied
OMG, works perfectly!!! So straight forward and elegant! Thank you so much ❤️
Copy link to clipboard
Copied
You're welcome.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Is a MouseUp event.