These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Radio button that returns a value in another field

josephrowan
Registered: Sep 27 2010
Posts: 3
Answered

This is so basic, I am embarrassed.
 
I have a series of radio buttons (with the choices a & b), that when checked, wants to return a value (1, 0) into a text box. The returned values get added up at the end.
 
What is the script that I should be using to transfer the value from the button to the text box? I have tried all sorts of things and just can't get it to work. I have seen examples of this, but cannot emulate it. Help!
 
Sorry for such a basic question.
 
Thanks.
 
 
 

My Product Information:
Acrobat Pro 9.4, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
The easiest way is to set the Button Value of each radio button to the corresponding value that you want to appear in the text field. Then set up the corresponding text fields as calculated fields with the following script:

// Calculate script
event.value = (getField("rb1").value === "Off") ? "" : getField("rb1").value;

Replace "rb1" with the name of the corresponding radio button.

If you ensure that one of the radio buttons is always selected, you can use "Value is the Sum of" or simplified field notation instead of a script.
josephrowan
Registered: Sep 27 2010
Posts: 3
George,
Thank you for your reply. Unfortunately, I was not able to get it to work. I am sure it is me not doing something correctly or not describing the problem well, but thanks again for the tip.


George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Accepted Answer
Here's a sample that demonstrates both of the approaches I mentioned earlier: https://acrobat.com/#d=tZTjjL4fdFhKJhZWKdr*lA
josephrowan
Registered: Sep 27 2010
Posts: 3
Thanks George! I will download and check that out. I appreciate it.