Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

2 Drop Down Menus

Avatar

Level 1

Hello All,

   Having trouble writing a formcalc script. I want DropDownList1 (which has 3 choices) to influence the list in DropDownList2 (which has 6 choices for each of 3 items in drop down list 1). Any ideas? Thanks

Here is my formcalc code:

if ( $.rawValue == 15010 ) then

form1.#subform[0].DropDownList2.access = ""

form1.#subform[0].DropDownList2.rawValue == " 22500, 22501, 22503, 22506, 22508, 225010 "

elseif ( $.rawValue == 15011 ) then

form1.#subform[0].DropDownList2.rawValue == " 22500, 22502, 22504, 22507, 22509, 225011 "

form1.#subform[0].DropDownList2.access = ""

elseif ( $.rawValue == 15012 ) then

form1.#subform[0].DropDownList2.rawValue == " 22500, 22505 "

form1.#subform[0].DropDownList2.access = ""

endif

7 Replies

Avatar

Level 10

Hi,

You need to update the binding list, not the selected value of DropDownList2, so use the setItems(), addItems(), ClearItems() methods.  Something like this in the change event of DropDownList1

if ( xfa.event.change == 15010 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,22501,22503,22506,22508,225010")

elseif ( xfa.event.change == 15011 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,22502,22504,22507,22509,225011")

elseif ( xfa.event.change == 15012 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,22505")

endif

Regards

Bruce

Avatar

Level 1

That didn't seem to work. Does it matter that it is a static xml? I need it to be a static xml as we use IPAD's on the shop floor in order to access this data.

Avatar

Level 10

Hi,

Will work fine as a static pdf form, but not sure about on an iPad.

Here's the code in a working form https://sites.google.com/site/livecycledesignercookbooks/home/bjb62r.pdf?attredirects=0&d=1

Are you getting any sort of error.

Regards

Bruce

Avatar

Level 1

Is there any way for the second box to point to a rawvalue? Lets say is if "22500" had a rawValue of "XXXX"?

Avatar

Level 10

Hi,

The setItems() method can take a csv list of display items or display item / value item pairs so if you wanted the rawValue of DropDownList2 to be the numbers from 1 to 14 you could use he following code;

if ( xfa.event.change == 15010 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,1,22501,2,22503,3,22506,4,22508,5,225010,6", 2)

elseif ( xfa.event.change == 15011 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,7,22502,8,22504,9,22507,10,22509,11,225011,12", 2)

elseif ( xfa.event.change == 15012 ) then

  xfa.host.resetData(DropDownList2)

  DropDownList2.setItems("22500,13,22505,14", 2)

endif

Is that what you were after?

Regards

Bruce

Avatar

Level 1

No not really. The values of 22500, 22502,etc are rawValues that point to text.

http://www.megafileupload.com/5lf9/front_nose_test.pdf

Thanks for the help!

Avatar

Level 10

Hi,

I can't get the megafileupload to down load the file, but I'm not sure what the question is.  Sounds like you can use the same syntax as I've given, just change the values of the first argument to "displayvalue,rawvalue,displayvalue,rawvalue, ..."

Regards

Bruce