PDF Tabbing action with multiple choice radio button group
Copy link to clipboard
Copied
I am using this code for my 'yes' or 'no' radio button groups in a PDF form;
if (event.target.value == "Yes") {this.getField("FIELD1").setFocus();}
else if (event.target.value == "No") {this.getField("FIELD2").setFocus();}
}
But, I have a group of radio buttons with 6 choices and all the JavaScript I've tried either ignores the second get field when tabbing or auto-selects when I arrow down to the next option. I know there must be a simple way but nothing is working. Thanks in advance!
Copy link to clipboard
Copied
What are the 6 choices and what code are you using?
If the code above is used in a "MouseUp" action on both the "Yes/No" radio buttons, then it is redundant. The user is clicking on either the Yes or No button, and the MouseUp is specific to the button, so you only need this code:
// Use this code in the Mouse up for the Yes button
this.getField("FIELD1").setFocus();
// Use this code in the Mouse up for the No button
this.getField("FIELD2").setFocus();
Do the same for your other fields.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
To set the focus to an individual widget in the group you need to access it directly. For example:
this.getField("FIELD1.1").setFocus();
This will set the focus to the second widget in the "FIELD1" group.
If you don't specify a widget number, the first widget (index number 0) will get the focus by default.
Copy link to clipboard
Copied
Thank you, it worked for 1 and 2 but I have 6 radio buttons, is there a way to group them so that if Choice1 is selected, it tabs to PatientReturnToDate textbox, and if any other Choice is selected, it tabs to the PrognosisComments textbox.
Copy link to clipboard
Copied
The answer is yes, and I already provided a working solution.
Go back and read the answer.
If you want more detail, then post the form.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
That code didn't work
Copy link to clipboard
Copied
I can assure you it does work.
Did you change the field name to match the name on your form?
Did you look in the console window to see if there were any reported errors?
Post the form and we'll take a look at it.
Use the Acrobat JavaScript Reference early and often

