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

Dropdownlist & Multipleselect list Problem

Status
Not open for further replies.

paragvshah

Programmer
Jan 11, 2001
109
IN
Hi Friends,

I am creating my site in Coldfusion & i need help regarding a problem that i am facing in my registration page where there are Textfields, Checkbox, Dropdownselect list, Multipleselect list.

I have hardcoded the values in Dropdownselect list & Multipleselect list which are transferred in to the database & after registration page i have provided a page for Edit profile page where user gets the same format page as of registration & here also values in Droplist & Multiplelist are hardcoded so the problem starts here.

What the user has selected in Droplist & Multiplelist while registration is displayed in edit profile page in Droplist & in Multiplelist but its displaying the value which it picks from dbase as selected & after that it also shows the same value which is hardcoded in the list.(e.g. In country India is selected is shown in Edit profile page as India selected at top of list & also with other countries in the list i.e. hardcoded one) What i want is that it should pick the selected value from database & should check with one in list & should select from that list only.

here is some part of code for reference from Edit profile page:

Multipleselect list
-------------------

<td height=&quot;36&quot; valign=&quot;top&quot;>
<CFOUTPUT QUERY=&quot;Update&quot;>
<cfset temp =&quot;#field_name_database#&quot;>

<select name=&quot;field_name_database&quot; multiple size=&quot;4&quot;>
<cfloop index=&quot;temp&quot; list=&quot;#temp#&quot; delimiters=&quot;,&quot;>

<option value=&quot;#temp#&quot; selected>#temp#
</cfloop>

<option value=&quot;Ae&quot;>Ae
<option value=&quot;Acs&quot;>Acs
<option value=&quot;Black&quot;>Black
<option value=&quot;asd&quot;>Asd
</select>
</CFOUTPUT>
</td>

Dropselect list
---------------

<td height=&quot;11&quot; valign=&quot;top&quot;>
<select name=&quot;Field_database_name&quot;>
<CFOUTPUT QUERY=&quot;Update&quot;>
<option value=&quot;#Field_database_name#&quot;>#Field_database_name#
</cfoutput>
<option value=&quot;als&quot;>als
<option value=&quot;Wo&quot;>Wo
<option value=&quot;Frag&quot;>Frag
<option value=&quot;Det&quot;>Det
</select>

Please help me out.

It would ne very nice if you can either send me code or give me address of the site from where I can down load that code.

regards
Parag Shah
 
I think Inderstand the Question, you want the update info page to show all the current information as Selected righ?

if so try this:

<select name=&quot;Field_database_name&quot;>
<option value=&quot;als&quot; <CFIF #Field_database_name# is &quot;als&quot;>Selected</CFIF> >als
<option value=&quot;Wo&quot; <CFIF #Field_database_name# is &quot;Wo&quot;>Selected</CFIF> >Wo
<option value=&quot;Frag&quot; <CFIF #Field_database_name# is &quot;Frag&quot;>Selected</CFIF> >Frag
<option value=&quot;Det&quot; <CFIF #Field_database_name# is &quot;Det&quot;>Selected</CFIF> >Det
</select>


That will give you the same dropdown list and the allready selected value (or the value in Field_database_name) will be allready selected. It won't be at the top but it will be selected. IF you absolutely need it at the top let me know and I'll figure that out (I'm sure it can be done)

hope it helps...

Have Fun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top