Answered
Hi There
I was wondering if anyone new a way of using FormCalc to change options in a dropdown based on another selections choice.
i.e. if from dropdown 1, choice 1 is selected, then in dropdown 2 I only want them to be able to select Choice 1 or choice 3 (because choice 2 in the dropdown is not available for choice 1 in dropdown 1).
Is there a way of 'greying out' the option or removing it compeltely using formcalc?
Thanks
this is possible.
You can use JavaScript and form variables to populate one dropdown list based on another dropdown lists choice.
First you need to create form variables (File > Form properties > Variables).
They contain an array of values you can select from the dropdown lists.
You need one for the first dropdown list and one for each choice for the second dropdown list.
For dropdown list 1 name it "List1" and put this script into value field.
For dropdown list 2 create 3 variables named "List2_Choice_AAA", "List2_Choice_BBB" and "List2_Choice_CCC".
Everyone then gets a different array (In this example several values from the pool of 111, 222, 333, 444, 555).
So, now you need to add scripts to the dropdown lists to populate them with the arrays.
For the first dropdown list you use this JS in the enter:event.
In the second you put.
So now the selection in the second dropdown depends on the first one and populates different array.
Some cosmetics to the behavior of the dropdown list is the final step.
If you already have selected a value in the first dropdown and change this, the second one needs to be cleared before populating with values.
This JA in the change:event does the job.
I know, it looks complicated at first, but it really isn't. ;-)
Sample Form
radzmar
• LoveCycle Blog
Documents you need:
• LiveCycle Designer ES2 Docs