Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Dropdown List - Multiple Text Fields - Data Connection

Avatar

Former Community Member

Hello all you Guru's out there. I'm brand new to Adobe LiveCycle, however I do have some coding experience in other languages, just not JavaScript and XML. I am trying to have a user select a Customer Name, and then based on that selection I would like to return several Address fields, a Contact name at the customer's location, and a phone number. The data connection is an ODBC connection to our CRM software, and all the information is stored within one table. The user of the form will be our Service Techs, and the remainder of the form will be a location to type notes regarding the service call. We are just trying to make the selection of the customer easier for our Service Techs instead of requiring them to type all of the information in themselves. I've searched the forums and the solutions I keep coming across are for user-defined values in the Dropdown list, I have not found an example demonstrating this with a data connection. I have it working from returning one address field to a text field (using the .rawValue command), but I need to populate a couple more fields with information. Any guidance would be greatly appreciated.

Thanking all of you in advance,

SSCLadam

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Thw way I have done this is to use two data Connections. The 1st one to populate the DDlist with a list of Customers. In this one I can use simple binding to get the job done. Then a 2nd connection that will extract the apppropriate record based on the selection of the DDlist. This one requires code and a SQL query to the DB to retrieve the appropriate record. In setting up that data connection I can use the column headers provided to bind the columns to the appropriate fields in my form. Then when that Data connection is opened ( I have it set to Delayed Open) and it returns the record in question the fields that are bound get populated automagically!

I have included a sample that I created ....you will not have the DB but you can at least see what I have done. The code is on the change event of the DDlist

Hope that helps

Paul

View solution in original post

4 Replies

Avatar

Correct answer by
Former Community Member

Thw way I have done this is to use two data Connections. The 1st one to populate the DDlist with a list of Customers. In this one I can use simple binding to get the job done. Then a 2nd connection that will extract the apppropriate record based on the selection of the DDlist. This one requires code and a SQL query to the DB to retrieve the appropriate record. In setting up that data connection I can use the column headers provided to bind the columns to the appropriate fields in my form. Then when that Data connection is opened ( I have it set to Delayed Open) and it returns the record in question the fields that are bound get populated automagically!

I have included a sample that I created ....you will not have the DB but you can at least see what I have done. The code is on the change event of the DDlist

Hope that helps

Paul

Avatar

Former Community Member

Paul,

Thank you so much, that solved my problem (with a little bit of tweaking to your code). I had to pull the Value from the Dropdown List instead of the text because the text is not unqiue in our database.

One simple question...Is it possible to display more than one field within the Dropdown List? For example, can I place the Company Name and the Contact name at the Company within the Dropdown list? This reason for needing this is that we service customers that have multiple locations and it'd be easier for the Service Techs to pick the correct customer if the Company Name and Contact were in the Dropdown List.

One last harder question....Is there an easy way to sort the data displayed within the Dropdown list? I do not have the option of selecting "Sort Ascending"...Your insight would be greatly appreciated.

Thanks again,

SSCLadam

Avatar

Former Community Member

No the DDlists only will support on evisible column ...you can display one thing but submit something else but it is still only one column.

You can sort but that woudl be after the fact ......I woudl suggest that you could add a sort parameter on teh SQL statement so that the data the comes in is already sorted. Otherwise you woudl have to put the result sin an array ....do the sort then cycle through each array node and append it to the list. So in essence you are doing the binding yourself.

Paul

Avatar

Former Community Member

Paul,

Thank you so much for all of your assistance, it is greatly appreciated! With this new found knowledge I think I'll be able to get this form knocked out in no time!

Have yourself a great day,

SSCLadam

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] ----