Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate text box onchange of select

Status
Not open for further replies.

RobertSBoyle

Programmer
Feb 21, 2001
16
0
0
EU
Hi there,
I'm pretty new to Coldfusion and am hoping for some help.

I have a form which contains a <cfselect> with a list of names. When I select a name I would like the address details for that name to be displayed in two text boxes. My query for the text boxes gives me an error when I try to refer to the <cfselect> name in the query.

Can Coldfusion do this? Should I be using Javascript? If so, can anyone point me in the right direction to find the information needed to complete this task?

Thanks in advance.
Robert
 
Can you post the code for us to view and/or correct?
The only dumb questions are the ones that are never asked
 
There are two ways to do this. (1) re-draw the page when a user makes a selection from the select list. This gives you the opportunity to query the database using the user-selected value in the WHERE clause of your query. (2) Use JavaScript to populate the text boxes without re-drawing the page. To achieve this, you must do all the queries that you might need BEFORE you draw the page. The recordsets returned from these queries must be transferred to the JavaScript environment so that JavaScript has access to them, and you must write JavaScript to populate the text boxes based on what the user selects. To use this latter method, you will need to use <CFWDDX>. Search the CF documentation for &quot;WDDX&quot; to learn how to use it. Look for an article called &quot;Moving Complex Data Structures Across the Web with WDDX&quot;.
 
Got it. I redrew the page as it seemed like the only way out!
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top