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!

Using CFselect with a string?? Help 1

Status
Not open for further replies.

mattwright

IS-IT--Management
Apr 14, 2001
1
US
Hi - I have been looking for the answer to this for days! Please help. I have a field in an access Db that has a comma delimited list in it. (ex. Blue, Green, Yellow)

I want to be able to write my cfselect statement so that the dropdown box seperates these values and lets me pass just one.

I am I way off base (can I do this at all).

Thanks Matt
 
Hi Matt,
I haven't been able to test it, but this should do the trick...

<cfset theList=QueryName.fieldName>
<form>
<select name=&quot;theList&quot;>
<CFLOOP INDEX=&quot;listElement&quot;
LIST=&quot;theList&quot;
DELIMITERS=&quot;,&quot;>
<option>#listElement#
</CFLOOP>
</select>
</form>

 
OK Matt, I've gotten a chance to test it. Only a couple of changes (notice the ## marks), but this should do it:
Of course you do your query before this bit of code. And change the QueryName.FieldName to whatever it is.

<CFSET list = ValueList(QueryName.FieldName)>

<form>
<select name=&quot;theList&quot; size=&quot;1&quot;>
<CFLOOP INDEX=&quot;listElement&quot;
LIST=&quot;#list#&quot;
DELIMITERS=&quot;,&quot;>
<option><cfoutput>#listElement#</cfoutput>
</CFLOOP>
</select>
</form>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top