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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing a form.

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I am writing an edit function for a form in which I pre-fill all the fields with the data stored in the database. The one I am having trouble with is a field that the user selects from a dropdown menu. I still want to present all the options, but I want the option in the database on top. The code to produce the list is shown below.

Code:
<!--- Display every employee. --->
<SELECT NAME=&quot;ProjLineMgr&quot;>
	<CFOUTPUT QUERY=&quot;GetPeople&quot;>
		<OPTION VALUE=&quot;#PersonID#&quot;>#PersonFirstName# #PersonLastName#</OPTION>
	</CFOUTPUT>
</SELECT>

I store ProjLineMgr in one table, and I have another table of people with their names and IDs. So, I need to query the employee table with ProjLineMgr to retrieve the name, and somehow put it on top while displaying the other names in case it is being changed. Any suggestions?
 
Hi Calista,

Is this what you're looking for? I'm assuming query Q1 contains the information you're populating in the form.

<SELECT NAME=&quot;ProjLineMgr&quot;>
<CFOUTPUT QUERY=&quot;GetPeople&quot;>

<OPTION VALUE=&quot;#PersonID#&quot;
<cfif Q1.projLineMgr is personID> selected=&quot;yes&quot;</cfif>
>#PersonFirstName# #PersonLastName#

</OPTION>
</CFOUTPUT>
</SELECT>

Hope this helps,
GJ
 
Boy, that was quick! Yes, that's exactly what I was looking for! Thank you! :-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top