Tom Chiverton wrote:
> Well, I'd lay out nicer:
>
> <select>
>   <option value="#value#"
>       <cfif value eq url.value> 
>               selected
>       </cfif>
>    >#text#</option>
> </select>
How is whitespace managed if you lay it out like that, I'm a bit 
obsessive compulsive about that ;)
> :points at CFEclipse :-)
>
>   
Yeah, yeah, I know, not an option... need rds on cf 5 through mx7 + I'm 
not yet happy  with how text is handled by eclipse, doesn't seem as 
robust as HS+, anyway, let's not get into that one...
>> An even better way for the above example would be to put the ' selected'
>> into a separate variable alongside the #value# and #text#
>>     
> Still leaves you with having to put an if of some sort inside the option tag.
>   
I mend like this:
<cfscript>
  myQuery = queryNew( "value,text,selected" );
  queryAddRow( myQuery, 2 );

  querySetCell( myQuery, value, 1, 1 );
  querySetCell( myQuery, value, "my item", 1 );
  querySetCell( myQuery, value, "", 1 );

  querySetCell( myQuery, value, 1, 2 );
  querySetCell( myQuery, value, "my item", 2 );
  querySetCell( myQuery, value, " selected", 2 );
</cfscript>

<select>
  <cfoutput query="myQuery">
    <option value="#value#"#selected#>#text#</option>
  </cfoutput>
</select>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249596
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to