Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

conditional drop down list

Avatar

Former Community Member

Hi Experts,

                  I have a requirement of having conditional drop down list - for e.g. there are two drop downs adjacent to each other

country

city - based on the selection for country appropriate state for that country selected from the drop down

for e.g. we have two country China and India

Country  - India China

City - (Mumbai , Delhi (belongs to country India)) and (Beijing, Shanghai (belongs to country China))

So requirement is when user selects India as country from drop down for country he should only get Mumbai and Delhi as drop down value for city and not Shanghai & Beijing

Similarly when he chooses China he should get city drop down values as Shanghai & Beijing and not (Mumbai and Delhi).

Please provide a sample scripting code. Country is bound by dynamic scripting.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I attached a sample with a drop-down for Canada and the United States, linked to a second drop-down with provinces and states.

Steve

View solution in original post

8 Replies

Avatar

Correct answer by
Former Community Member

I attached a sample with a drop-down for Canada and the United States, linked to a second drop-down with provinces and states.

Steve

Avatar

Former Community Member

Hi Steve,

               Thanks a lot for ur sample pdf - hv no words to express how this sample will be of immense help for my current deliverable. I shall be making slight changes to the script - values for the drop down menu have to fetched from the database instead of being hardcoded in the script object as array elements. I got a similar post initiated by Niall about WSDL file binding to drop down list whereby we can get data from the database. Combining these two I feel I shall be able to make significant breakthru in fixing current issue.

will keep u updated about my progress and will post any significant finding that can add value to the forum.

Thanks a lot again and Merry Christmas and Happy New Year in advance.

Thanks

Rohit

Avatar

Level 1

Hello,

I saw your post and it is very interesting. I want to do something similar, but instead of countrys I am using car models. Y changed the arrays and tested using your code and works OK. using the sample you sent. The problem comes when I migrate the code to my form, how can I "link"the conditional dropdownlist to a specific dropdown list? I am using more than two drop down lists in my template.

Many thanks!

Avatar

Former Community Member

Did you migrate the script objects as well?

Steve

Avatar

Level 1

Oops I didn't! just saw the script editor window with the code to populate the fields.

It is working perfect now.!

Many thanks for your help =)

P.

Avatar

Level 2

I found this post and it answers about 80% of my issues. I am trying to create a deeper relation though and was curious if there was an easier way to modify this current script to extend it to additional drop down menus as needed. So far I have been editing the xml code directly. (Only because its easier for me to grasp that way. )


Forgive my ignorance as I am a total noob to form design and Adobe Live Cycle.

Any guidance you could offer as to how to easily link additional drop down boxes in this script?

Thanks so much!!!

Avatar

Former Community Member

Hi Steve,

I will take a look at your file. Without using a DDL, I'm trying to input a zip code into field 1 and have the corresponding city/town auto populate in field 2 using a table.

Example if field 1 is 11747, then field 2 should fill with Melville.

Thanks in advance

Avatar

Level 8

Thanks a lot. The sample form works in PDF preview, but it doesn't work in HTML5 preview mode.

Any feedback would be appreciated.

Tarek

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----