Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How Do I: Fill a read-only field based on selections from 2 DDlists?

GlennCauley
Level 2
Level 2

Follow-up from issue:  

http://forums.adobe.com/message/2417876#2417876

I have 2 drop-down lists...  "Department" and "SubDepartment"

The selection in DDlist "Department" spawns a unique list in DDlist "SubDepartment"

I select the proper items from both DDlists.

When I do this, I want read-only text field "NameOnIDBadge" to be populated with a pre-defined entry.

Example:

In "Department" DDlist, select item "Finance & Administration"

In "SubDepartment" DDlist, select item "Food Service" from the list that appears

THEN:

In read-only text field "NameOnIDBadge" the following predefined read-only text appears:  "Contract Food Serv."

(Thanks to Paul, I already know how to make the selection in DDlist "Department"  affect the selection list in DDlist "SubDepartment"

but I don't know how to make the selection of both DDlists create a new pre-defined entry in a text field.)

I have attached a mockup of the file I am working with...

1 Accepted Solution
xrum
Correct answer by
Level 4
Level 4

if ((firstDDList.rawValue="Whatever") && (secondDDList.rawValue = "Whatever"))

yourTextBox.rawValue="the right text"

this code would go under the second DDList Exit event, replace the code i put in there to add the check of the first DDList

View solution in original post

7 Replies
xrum
Level 4
Level 4

yourtextBox.rawValue="Contract Food Serv."

see attached

GlennCauley
Level 2
Level 2

I tried that but a few things went wrong.

1. After I select "Food Service" in the second "SubDepartment" DDlist, a Javascript error message pops up (see attached), and I have to click it to make it go away.  Then the text "Contract Food Serv" appears in the text box.

2. If I select a different value in the Department DDlist, the rawtext still remains in place... it should clear out.

3. The raw text seems to be based on the selection of the SubDepartment DDlist only.  However, I need specific raw text to be generated based on the combination of BOTH DDlists.   (It could happen that a totally different Department DDlist could have the same item in its corresponding SubDepartment DDlist.  In that case, the rawtext would be completely different.)

Correct example:

Department DDlist = Finance & Administration

SubDepartment DDlist = Food Service

NameOnIDBadge = Contract Food Serv  <-- CORRECT

Incorrect example:

Department DDlist = Clinical Services

SubDepartment DDlist = Food Service

NameOnIDBadge = Contract Food Serv   <--  INCORRECT   (it might be something else)

xrum
Level 4
Level 4

its not an error message, its a pop up i've put in place to check what's selected, and to make sure the logic works corrently, you can remove it from code.

to clear the text, put

yourtextboxname.rawValue = ""

on the exit event of the first drop down, etc.

have you looked at the code at all?

GlennCauley
Level 2
Level 2

Thank you for your response.

I am a novice at learning code at this point, but yes I did look at it.

The issue still remains that the rawtext is triggered by the selection from the second SubDepartment DDlist only... not based on the combination of both DDlists.

xrum
Correct answer by
Level 4
Level 4

if ((firstDDList.rawValue="Whatever") && (secondDDList.rawValue = "Whatever"))

yourTextBox.rawValue="the right text"

this code would go under the second DDList Exit event, replace the code i put in there to add the check of the first DDList

View solution in original post

GlennCauley
Level 2
Level 2

Excellent! 

I'll redo it and test... and post back.

Thank you!

GlennCauley
Level 2
Level 2

Thank you for pointing me in the right direction.

The only changes I had to make was to add a double "==" in the scripting for the selections from the 2 DDlists.

(Using a single "=" would cause things to not work properly.)

if ((firstDDList.rawValue=="Whatever") && (secondDDList.rawValue=="Whatever"))

yourTextBox.rawValue="the right text"