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

[ASK] Making Radio Button Checked / Unchecked Through Evaluation

jaycorbix
Registered: Apr 28 2010
Posts: 2

Dear all,

I have two fields:
1. Field1
2. Field2

I also have two Radio buttons with the same name but with different labels,

1.RadioButton(1).label = "YES"
2.RadioButton(2).label = "NO"

From the fields I have to make an evaluation and set the radio button as checked/unchecked.

The formula is like this:

if Field1 >= Field2 then

radiobutton(1).checked = true; // Radio Button with "YES" label is checked
radiobutton(2).checked = false; // Radio Button with "NO" label is unchecked

else

radiobutton(1).checked = false; // Radio Button with "YES" label is unchecked
radiobutton(2).checked = true; // Radio Button with "NO" label is checked

How can I achieve this in Acrobat? :)

My Product Information:
Acrobat Standard 7.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Radio-buttons are mutually exclusive, so there's no need to check one and uncheck the other.
You just set the value you want to be checked, like so:

f1 = this.getField("Field1").value;f2 = this.getField("Field2").value; if (f1>=f2) {event.value = "YES";} else  event.value = "NO";

You place this code as the custom calculation script of one of the radio-buttons.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com