Second dropdown field is dependent on what is chosen in the first dropdown

75 views
Skip to first unread message

Brenda Bourgette

unread,
Feb 17, 2023, 5:18:04 PM2/17/23
to Adobe LiveCycle Developers
I am trying to get a second dropdown list to change depending on the choice made in the first dropdown.  I need to make sure the choice in the second dropdown is cleared if a different choice is made in the first dropdown.  Also can I reference the binding Item value instead of the text in the first dropdown (eg. instead of "Choice 1" get the rawValue)?  I will have eight choices in the first dropdown when I'm done - is there a limit?  Here is my code that is not working

//     First dropdown is named DropDownList1 and the second dropdown is named 
        SecondDropDown

switch(this.rawValue) {

case "Choice 1":
SecondDropDown.clearItems();   // clear out SecondDropDown
SecondDropDown.addItem("Other");
SecondDropDown.addItem("Manager");
SecondDropDown.addItem("Director");
break;

case "Choice 2":
SecondDropDown.clearItems();
SecondDropDown.addItem("System 1");
SecondDropDown.addItem("System 2");
SecondDropDown.addItem("System 3");
SecondDropDown.addItem("System 4");
SecondDropDown.addItem("System 5");
break;

case "Choice 3":
SecondDropDown.clearItems();
SecondDropDown.addItem("Operation 1");
SecondDropDown.addItem("Operation 2");
SecondDropDown.addItem("Operation 3");
SecondDropDown.addItem("Operation 4");
SecondDropDown.addItem("Operation 5");
break;
}

Thank you so much for all your help!

Brenda Bourgette

unread,
Feb 18, 2023, 11:55:54 AM2/18/23
to Adobe LiveCycle Developers
I put this code in the Exit event of the DropDownList1 field.

fred.pantalone

unread,
Feb 18, 2023, 4:20:08 PM2/18/23
to Adobe LiveCycle Developers
There is no technical limit to items in dropdown lists that I know of. If there is a limit you are nowhere near it.

What isn't working with your code? You can debug it with tracing messages. I use console.println() or app.alert()
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Brenda Bourgette

unread,
Feb 19, 2023, 12:57:02 PM2/19/23
to Adobe LiveCycle Developers
I got it all to work with the following code:

//  First dropdown is named DropDownList1 and the second dropdown is named SecondDropDown

switch(this.rawValue) {

case "Choice 1":
SecondDropDown.rawValue = null;
SecondDropDown.clearItems(); // clear out SecondDropDown in case the user has chosen something else first

SecondDropDown.addItem("Other");
SecondDropDown.addItem("Manager");
SecondDropDown.addItem("Director");
break;

case "Choice 2":
SecondDropDown.rawValue = null;

SecondDropDown.clearItems();
SecondDropDown.addItem("System 1");
SecondDropDown.addItem("System 2");
SecondDropDown.addItem("System 3");
SecondDropDown.addItem("System 4");
SecondDropDown.addItem("System 5");
break;

case "Choice 3":
SecondDropDown.rawValue = null;

SecondDropDown.clearItems();
SecondDropDown.addItem("Operation 1");
SecondDropDown.addItem("Operation 2");
SecondDropDown.addItem("Operation 3");
SecondDropDown.addItem("Operation 4");
SecondDropDown.addItem("Operation 5");
break;

}

Brenda Bourgette

unread,
Feb 19, 2023, 2:20:46 PM2/19/23
to Adobe LiveCycle Developers
I would still like to know how to reference the Binding - Specify Item Values instead of the text in Field - List Items.

fred.pantalone

unread,
Feb 20, 2023, 10:01:24 AM2/20/23
to Adobe LiveCycle Developers
Glad that you got it working. However, I don't understand your question. The way you are calling addItem() there is no bound value, only the display value. Look at the docs for addItem() and you'll see that you can include 2 input parameters. The second one, which is optional, is for the bound value. Is this what you're referring to?

Duane Nickull

unread,
Feb 20, 2023, 12:08:42 PM2/20/23
to live...@googlegroups.com
On Saturday, February 18, 2023 at 4:20:08 PM UTC-5 fred.pantalone wrote:
There is no technical limit to items in dropdown lists that I know of. If there is a limit you are nowhere near it.

The worst of this I witnessed when I saw a form that had 6 or 7 address blocks in it. The perpetrator had duplicate drop downs of the ISO country lists, state/province lists etc for each separate clock.  Nothing like a 67 MB PDF form on a mobile device. 

I had engineered a product alongside another ex-Adobe employee that created HTML5 forms for mobile for LC ES using a drag and drop GUI. We never brought it to market but one of the strengths of it was to be able to use dynamic JIT binding to those lists (instead of the list of US states being static, it was retrieved only when the country code for US was selected first.  It ran really fast.

I am now wondering if there is sufficient interest to continue to develop it. The old code base is still in existence.

D

Duane

--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to livecycle+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/livecycle/8b27071b-780e-46f5-b869-16b55eb16860n%40googlegroups.com.


--
******************************
CTO Hired Gun - speaking only for myself
s. Bootstrap 5, jQuery, HTML5, CSS3+, PHP, Node.js, Neo4J & more
@duane...@hachyderm.io

NOTICE: This e-mail and any attachments may contain confidential information. If you are the intended recipient, please consider this a privileged communication, not to be forwarded without explicit approval from the sender.  If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. The originator reserves the right to monitor all e-mail communications through its networks for quality control purposes.

Brenda Bourgette

unread,
Jan 22, 2024, 12:45:42 PMJan 22
to Adobe LiveCycle Developers
I am trying this code again and its not working.  I tried putting it in the Exit event and then I cut and pasted it into the Change event.  In either case it's not working.  

Here is the code:

switch(this.rawValue) {

 

case "1":

Branch.rawValue = null;

Branch.clearItems(); // clear out Branch in case the user has chosen something else first

 

Branch.addItem("Not Applicable");

break;

 

case "2":

Branch.rawValue = null;

Branch.clearItems(); // clear out Branch in case the user has chosen something else first

 

Branch.addItem("Not Applicable");

break;

 

case "3":

Branch.rawValue = null;

Branch.clearItems(); // clear out Branch in case the user has chosen something else first

 

Branch.addItem("Option 1");

Branch.addItem("Option 2");

Branch.addItem("Option 3");

break;

 

case "4":

Branch.rawValue = null;

 

Branch.clearItems();

Branch.addItem("System 4");

Branch.addItem("System 5");

Branch.addItem("System 6");

break;

 

}


Any help would be greatly appreciated.


On Friday, February 17, 2023 at 5:18:04 PM UTC-5 Brenda Bourgette wrote:

fred.pantalone

unread,
Jan 22, 2024, 1:49:27 PMJan 22
to Adobe LiveCycle Developers
As I wrote in my previous post: What isn't working with your code? You can debug it with tracing messages. I use console.println() or app.alert()

What isn't working? Have you tried debugging using the above tools? You haven't provided enough information to receive meaningful help.
Reply all
Reply to author
Forward
0 new messages