Populate Dropdown depending on Radio Button Selection
Hey Experts
I have a scenario where I need to the dropdown options to change depending on the selection of a radio button
In my form, I have two Radio buttons and two text boxes
When the Yes is ticked, the SelectPackage dropdown options are:
1. B&W Photos & Keyring
2. Color 4x6 Photos & Keyring
3. Color 8x10 Photos & Keyring
4. Other
When the No is ticked, the SelectPackage dropdown options change to below:
1. B&W Photos
2. Color 4x6 Photos
3. Color 8x10 Photos
4. Other
I also have a couple of curveballs that I would like.
- If any of the options are 1, 2 or 3, the OtherPackage Textbox is Inactive, but if option 4. Other is selected OtherPackage textbox becomes active
- If the Radio button Yes is selected, and then option 4 Other is selected OtherPackage textbox becomes active, user types a requirement and when he tabs out, need to concatenate whatever has been typed and & keyring to populate
If the user tries to choose a dropdown selection before selecting a Yes or No, an error message to pop up asking the user to first select one of the radio buttons

I have googled and modified and entered the below code in the Custom calculation script, but it doesn't work
//Clear the dropdown displayed value and items
this.rawValue = null;
this.clearItems();
//Repopulate the items based on the radio buttons
if (PacChoice.rawValue == 1)
{
this.addItem("B&W Photos & Keyring");
this.addItem("Color 4x6 Photos & Keyring");
this.addItem("Color 8x10 Photos & Keyring");
this.addItem("Other");
}
else if (PacChoice.rawValue == 2)
{
this.addItem("B&W Photos");
this.addItem("Color 4x6 Photos");
this.addItem("Color 8x10 Photos");
this.addItem("Other");
}
else
{
app.alert("Please select a package option first");
}
I am not an expert in javascript, but I tried to get something before asking for help
Your help would be much appreciated
Regards
Rahul
[Post moved from the Coding Corner wasteland to the Acrobat forum. -Mod.]
