Copy link to clipboard
Copied
If a user clicks on the "Yes" radio button they should jump to one field. If they click on the "No" button they should jump to another field. How can I do this? Thanks.
Copy link to clipboard
Copied
Select all radiobuttons, go to Properties : Actions : Mouse up : Run a JavaScript
and paste this script after editing target fields names
if (event.target.value != "Off") {
if (event.target.value == "Yes") {this.getField("FIELD1").setFocus();}
else if (event.target.value == "No") {this.getField("FIELD2").setFocus();}
}
Copy link to clipboard
Copied
You can remove the first condition and it will still work exactly the same.
Copy link to clipboard
Copied
You mean
if (event.target.value != "Off")
right?
Copy link to clipboard
Copied
Yes Try67 is right, this line is useless for radio-buttons, but since it's useful for checkboxes and since I mostly use checkboxes I gave you the script as is. 😉
Don't forget to also remove the 2 associated curly braces.
Copy link to clipboard
Copied
OK, thanks. I know nothing about Java, but I'll see if I can make it work.
Copy link to clipboard
Copied
First thing to learn is that Java and JavaScript are not the same thing, and that the latter is what is used for scripting in Acrobat...
Copy link to clipboard
Copied
Wondering how to use this if I have more than two options? Tried quite a few different ways but it either ignores the second get or automatically selects the next button I move to with the arrow key. Thank you!