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

Combo Box

llr650
Registered: Mar 10 2010
Posts: 3
Answered

Total noob here guys. I was wondering if there is a way to select a value from a combo box and activate (check) certain check boxes? If there is a way how would i start the code?

Example:

Checkbox has three values "One" "Two" "Three"; If the "One" is selected then checkbox 1 should be checked. If "two is selected then check boxes 1 and 2 should be checked and so on. If nothing is selected in the combo box no check boxes should be checked.

i Have this much so far:
(in validate for the combo box))

if(event.value == "One")
{
this.getField("Check Box3").checkThisBox(0,true);
this.getField("Check Box2").checkThisBox(0,false);
this.getField("Check Box1").checkThisBox(0,false);
this.getField("Check Box4").checkThisBox(0,false);
};

if(event.value == "Two")
{
this.getField("Check Box1").checkThisBox(0,true);
this.getField("Check Box4").checkThisBox(0,false);
this.getField("Check Box3").checkThisBox(0,false);
this.getField("Check Box2").checkThisBox(0,true);
};

if(event.value == "Three")
{
this.getField("Check Box1").checkThisBox(0,true);
this.getField("Check Box4").checkThisBox(0,false);
this.getField("Check Box3").checkThisBox(0,True);
this.getField("Check Box2").checkThisBox(0,true);
};

else
{// Restore values
this.getField("Check Box3").checkThisBox(0,false);
this.getField("Check Box2").checkThisBox(0,false);
this.getField("Check Box1").checkThisBox(0,false);
this.getField("Check Box4").checkThisBox(0,false);
}

I know my coding is off somewhere but i dont exactly know where. Thanks in advance.

try67
Expert
Registered: Oct 30 2008
Posts: 2399
Drop the semi-colon after each block and add an "else" before the if's, like so:
if (...) { } else if (...) { } else if (...) { } else { }

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

llr650
Registered: Mar 10 2010
Posts: 3
Thank you for your reply. That worked perfectly!