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

ComboBox and RadioBox(On/Off), pls help~

andrewchow11
Registered: Mar 28 2011
Posts: 20

Hello all,
 
In Acrobat form javascript,
I created 2 ComboBox(CB1 and CB2),
CB1 to involve 3 RadioBox(RB1a, RB1b and RB1c),
CB2 to involve 3 RadioBox(RB2a, RB2b and RB2c).
 
If you press "ON" CB1, the RadioBox(RB1a, RB1b and RB1c) can be choose. And the CB2, and RadioBox(RB2a, RB2b and RB2c) is Readonly and "OFF".
 
Conversely,
If you press "ON" CB2, the RadioBox(RB2a, RB2b and RB2c) can be choose. And the CB1, and RadioBox(RB1a, RB1b and RB1c) is Readonly and "OFF".
 
If you do not press "ON" the CB1 and CB2, then RadioBox(RB1a, RB1b, RB1c, RB2a, RB2b, RB2c) is Readonly and "OFF".
  
How can do that?
Pls help and thanks!

My Product Information:
Acrobat 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Radio buttons usually have the same name, if they are to work as a group.
However, you can use a variation on this code as CB1's MouseUp action:

if (this.getField("CB1").value=="Yes") {
this.getField("RB1a").readonly = false;
this.getField("RB1b").readonly = false;
this.getField("RB1c").readonly = false;
} else {
this.getField("RB1a").value = "";
this.getField("RB1b").value = "";
this.getField("RB1c").value = "";
this.getField("RB1a").readonly = true;
this.getField("RB1b").readonly = true;
this.getField("RB1c").readonly = true;
}

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

andrewchow11
Registered: Mar 28 2011
Posts: 20
Thanks try67,
But CB1 press "ON" and choose RB1b,
and then, If CB1 "ON" directly change CB2 "ON", RB1b has not been eliminated?

try67
Expert
Registered: Oct 30 2008
Posts: 2398
Sorry, I don't really follow.
You will probably need to adjusts this script to be used with your other check-box as well.

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

andrewchow11
Registered: Mar 28 2011
Posts: 20
oh sorry, i have typing the wrong word,
I created 2 "CheckBox(CB1 and CB2)"
try67
Expert
Registered: Oct 30 2008
Posts: 2398
I understood that, actually. So what is the problem?

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

andrewchow11
Registered: Mar 28 2011
Posts: 20
Thanks a lot!!

In CheckBox and RadioBox script, i have successfully modified the following:
=======================================================================
if (this.getField("CB2").value=='0') {
this.getField("RB1").readonly = false;
this.getField("RB2").readonly = true;
this.getField("RB2").value = '';
} else {
this.getField("RB1").value = '';
this.getField("RB1").readonly = true;
}
=======================================================================

But why I create one textbox to get RadioBox value,
and set numberical format, the results display "Off" in textbox1??
=======================================================================
event.value = this.getField('RB1').value;
} else {
event.value = this.getField('RB2').value;
}
=======================================================================

Please help and thanks~