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

cfselect question

Status
Not open for further replies.

infocusweb

Technical User
Jan 8, 2001
17
0
0
US
I was wondering if it was possible to display two columns in a drop down, like catagoryid and catagory name. My id's are not autonumber so I would like them displyed with the names. If not, is there a good alternative?

<cfselect name=&quot;CategoryId&quot; size=&quot;1&quot; query=&quot;Categories&quot; value=&quot;categoryID&quot; display=&quot;Name&quot;>
</cfselect>

Thanks.
 
hi novonod

Are you saying that you'd like each option to display 2 values instead of just the name? Maybe number-name or something?

Id suggest using a standard HTML select box and creating your own dynamic list as opposed to using CFSELECT.

You just start an HTML select box, give it the name you want to reference the form variable as. Then, use CFOUTPUT to loop through your Categories record set. The ## will display the columns from your query wherever you want. The option tag will be written once for every record returned, and will accomplish the dynamic result you were looking for.

<select name=&quot;categoryID&quot;>
<CFOUTPUT query=&quot;categories&quot;>
<option value=&quot;#categoryID#&quot;>#categoryID#-#name#
</CFOUTPUT>
</select>

 
thanks strantheman, that takes care of it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top