The IIf way would be:
<option value="#name#" #IIf(Form.Name EQ Name, DE("selected"),
DE(""))#>#name#</option>
Or something along those lines, it is slower though due to the DE()
functions. Why not just put the CFIF within the option tag?
<option value="#name#" <cfif Form.Name EQ
Name>selected</cfif>>#name#</option>
This all assumes that Form.Name is always defined, I am guessing you have a
cfparam towards the top of the page for that, like so:
<cfparam name="Form.Name" default="">
Snipe - <CF_BotMaster Network="EFNet" Channel="ColdFusion">
----- Original Message -----
From: "Bryan LaPlante" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 30, 2001 11:46 AM
Subject: Re: <SELECT>
> I imagine you are pulling your list from a database and using the query of
a
> cfoutput, just add this code to it.
> <select>
> <cfoutput query="mybooknames">
> <cfif name is form.name><cfset selected = "selected"><cfelse><cfset
selected
> = ""></cfif>
> <option value="#name#" #selected#>#name#</option>
> </cfoutput>
> </select>
> there is a way to do it in one line with iif() but I can't remember that
one
> right off.
>
> Bryan
>
> ----- Original Message -----
> From: "Tony Hicks" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, September 30, 2001 5:00 AM
> Subject: <SELECT>
>
>
> Hey Guys...
>
> I have a problem, my site, www.bibleclicks.com has one request from people
> that send me feedback.. they want me to set it so that when a user selects
a
> book and searches, the book remains selected on the next page.. the
problem
> comes in here:
>
> It would take about 75 cfif tags to do it and some of them would be long..
> my host is generous with bandwidth but.. I'm smart, I don't want to push
the
> limits.. is there an easy way to do this?
>
> Thanks,
> Tony Hicks
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists