Not true about selected instead of selected="selected" Selected works for HTML4, selected="selected" is for XHTML. It will depend on what is being used, but HTML4 supports selected="selected" and xhtml does not support selected. So in this case it is probably best to use selected="selected"
Steve -----Original Message----- From: Yuliang Ruan [mailto:[email protected]] Sent: Thursday, May 27, 2010 4:23 PM To: cf-talk Subject: Re: How to make a select option tag selected in CF? btw, it should be just selected not selected="selected" <option value="clothes" <cfif form.choice is "clothes">SELECTED</cfif>>Clothes</option> if your list of options is long and u need it to be hardcoded, u should put it into a array of struct. i.e. <cfset myChoices=[{value="nothing", text="Please Choose from Below"}, {value="clothes", text="Clothes"}, {value="sports",text="Sporting Goods Store"}, etc etc etc ]> <select name="choice"> <cfloop array="#myChoices#" index="thisChoice"> <option value="#thisChoice.value#" <cfif form.choice eq thisChoice.value>SELECTED</cfif>>#thisChoice.text#</option> </cfloop> </select> of course even better would be these in a lookup db table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334063 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

