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.

Drop Down Lists that connect with eachother

Avatar

Former Community Member
I'm trying to make a form in which I have the following fields:



To:

Company:

Email:

Fax:



Now I want to do a drop down list because I have several contacts, but I want it so that when I chose the person in the "To:" field, it will put the company, email and fax for that person in the rest of the fields. I put the details into drop down menus for the rest of the fields but I can't get it to relate joe shmoe to his email joeshmoe@whatever.com and so on.



HELP!
18 Replies

Avatar

Former Community Member
Where is the information going to reside that ties the To, Company, Emal and Fax to the user that is selected in the dropdown? Are you going to hard code it or is it in a database somewhere, or maybe a Web Service call?



Once we know that we can point you in the right direction.

Avatar

Former Community Member
I'm going to hardcode it, databases are too advanced for me right now! haha

Avatar

Former Community Member
a 'simple' solution.. you could add script to the CHANGE event of the drop down list such as:



if (xfa.event.newText == "Joe Shmoe")

{

emailAddress.rawValue = "jshmoe@snailmail.com";

company.rawValue = "ABC";

}



and so on..

Avatar

Former Community Member
Sorry for being so annoying, but I'm really really new to using forms, I'm not too bad with computers but I'm just not sure where the change event of the drop down list would be or how I can get to it. Could you please explain a bit more?



Thanks so much

Avatar

Former Community Member
Launch Designer and open your form. Once it comes up Click on the Windows menu and ensure the Scripting Editor is enabled. Below the toolbars but above the form display is a blank area that is the scripting editor. At the top of that area are dropdowns that allow you to pick events as well as scripting language and location. Click on the dropdown that you want to code. Make sure the language in the script editor is set to Javascript and it is set to run at Client. In the event dropdown, choose Change. In the blank area you can add your code. Note that the script editor will show you the code that is associated with the object that has focus.

Avatar

Former Community Member
About a month later, but I got it to work! thanks very much, would have never figured it out on my own :D

Avatar

Former Community Member
Hi,



I would like to hardcode this same example except there are 500 records or more. For example, the user puts the Product Code in the textbox and then the description that matches that Product Code should automatically populate in the Description textbox (which will be read-only).



However, I basically want to put the Product Code and Description into an invisible list box and then loop through the list box to match up the description for the product code the user enters and put that information into the description textbox.



The manager wants no DB connection for these forms.



Thanks.

Vee

Avatar

Former Community Member
So you will hardcode the values in the listbox ....I sure hope one does not change. I would not use a list box because you will have to loop through each enter to get your match. Can you not use some sort of array structure with and index to make it easier and more efficient to make the match?

Avatar

Former Community Member
Hi, Paul:



Actually, the listbox info would not change; however, more would and could be added to the list.



I am very interested in using an array structure with an index. How do I even get started on that?



I am a beginner programmer so if you can help me get started, I am sure I can finalize.



Thanks for your quick response; still working on this project for which they would like today.



Vee

Avatar

Former Community Member
If you look at the dynamic interactive/purchase order sample that ships with the product it does something similar with states and provinces in one dropdown and countries in the other. That sample can be found in the designer install directory/EN\Samples\Forms\Purchase Order\Dynamic Interactive\Forms

Avatar

Former Community Member
Thank you, Paul! I will take a look at it and see if I can take similar steps to do this.



Vee

Avatar

Former Community Member
Hi, Paul: Is there any way you can take a look at my sample code for this array? I placed it inside of the Purchase Order Sample and tried it that way, but it will not work. I am not sure what I am not doing since I followed the sample itself.



Please let me know.



Thanks.

Vee

Avatar

Former Community Member
Send it to livecycle8@gmail.com and I will have a look next week.

Avatar

Former Community Member
Hi, Paul!



I just sent the pdf file with code in the variable associated with the parts in the Purchase Order sample to the email above.



Thank you very much in advance...



Vee

Avatar

Level 4
I am a newby! I'm trying to do a similar thing but with postcodes. From a dropdown box our clients can select their town. I would like for the postcode to automatically be entered in accordance with the town select.



If you can help it would be greatly appreciated.



J

Avatar

Former Community Member
Where are the post codes going to come from? You can hardcode them but that would be a lot of code.

Avatar

Level 4
What are my other options? Can I import them from a website?

Avatar

Former Community Member
If you have Acrobat you can get the info from a DB or a Web Service. You can do the same thing with Reader but th eform must be Reader Extended by Livecycle Reader Extensions product to allow this connections to happen. If you do not want to go down that path then your other option is to create a data file where you can import them or you can code them into the form.