Copy link to clipboard
Copied
I have a form that has 2 sets of radio buttons (on and offs).
I have been given a constraint that both EZ-Start and Auto-Trial both cannot be set to On at the same time. It has to be one of the other.
Is there a way that if EZ-Start is set to On, then it automatically sets Auto-Trial to "Off" and vice versa? I assume this would have to be done with Javascript somehow?
Copy link to clipboard
Copied
Yes, Use a Mouse Up script on both of the "On" radio buttons, to force the other radio button group to Off.
for example, here's the script for the EZ-Start On button. Note that I'm guessing the field name. You'll need to replace the name in my script with the exact name that is used on your form.
this.getField("Auto-Trial").value = "Off";
Copy link to clipboard
Copied
This will work if you want the user to clear the other group when you turn the group on, instead of togging it to off.
Copy link to clipboard
Copied
In a Mouse Up action of each button, set the value of the other group to the export value of the button in that group that corresponds with the Off or On lable. Assuming the field group names are EZ-Start and Auto-Trial, and the export values are Choice1 and Choice2, enter the following script in both EZ-start buttons:
if(event.target.value=="Choice1")
{this.getField("Auto-Trial").value="Choice2"}
else
{this.getField("Auto-Trial").value="Choice1"}
Enter the following script as a Mouse Up action in both Auto-Trial buttons:
if(event.target.value=="Choice1")
{this.getField("EZ-Start").value="Choice2"}
else
{this.getField("EZ-Start").value="Choice1"}