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

Any one have a sample script to turn on a Radio Button?

schmonkey
Registered: Oct 31 2007
Posts: 5

I'm using Formcalc and I've got a radio button named Radio_Button2_0_5 and if this Radio_Button2_0_5 is clicked so its value is Yes1, I want Radio_Button2_0_6 automatically set to Yes1. In other words, I created sets of radio buttons in Designer and if one set of radio buttons gets clicked 'on', then I want all radio buttons under that button to automatically be set to 'on' state.

I'm using Formcalc on the client. For the 'click' event on Radio_button2_0_5, I entered the simple script as follows:

Radio_Button2_0_6.rawValue == "Yes1"

I do a PDF Preview and click on Radio_Button2_0_5 (the first radio button of three) but nothing happens to the first radio button of Radio_Button2_0_6. The script doesn't blow up but it doesn't appear to work either.

I obviously am new to FormCalc but I'm willing to use JavaScript if one exists that I can clone. I have looked in FormCalc examples on the Adobe website and have googled trying to find a sample script but have been unsuccessful to-date. I'm posting on this forum for the first time, hoping that maybe one of you have attempted to do the very thing I'm trying to do and can post some sample code for me to try.

This has got to be really easy but I'm new to Formcalc and don't know Javascript all that well - but I'm willing to use it if anyone has an example script of what I'm trying to do. Anyone able to give me an example script that would do what I need it to?

Thanks,

Dan

amin.nas
Registered: Oct 3 2007
Posts: 37
Dan,

You can use the following javascript, assuming that the you have defined the radio button groups as set1 and set2:

var set1V = form1.set1.rawValue;

if (set1V == "Yes1")
{
form1.set2.rawValue = "Yes1";
}

set1 includes the radio_button2_0_5 and set2 includes the radio_button2_0_6.

best,
amin
schmonkey
Registered: Oct 31 2007
Posts: 5
Amin:

Thank you! That worked perfectly!

Regards,

Dan
schmonkey
Registered: Oct 31 2007
Posts: 5
Amin:

You inspired me! I was able to add the following code to one of the buttons and it works great:

var set1V = P1.Radio_Button2_0_6.rawValue; var set2V = P1.Radio_Button2_0_7.rawValue; var set3V = P1.Radio_Button2_0_8.rawValue; var set4V = P1.Radio_Button2_0_9.rawValue; if (set1V == "Yes1") {P1.Radio_Button2_0_5.rawValue = "Yes3"}; if (set1V == "Yes1" && set2V == "Yes1" && set3V == "Yes1" && set4V == "Yes1") {P1.Radio_Button2_0_5.rawValue = "Yes1"};Now, I'll be able to play all kinds of form games! Without your help I never could have got this far.

Regards,

Dan
amin.nas
Registered: Oct 3 2007
Posts: 37
My pleasure Dan!