Actually, from a performance perspective CFSELECT is much faster than
using
a CFOUTPUT in a SELECT tag. I, too have had this problem and here is
my
solution:
You have to put it in the SQL statement. Here is an Oracle example...
<cfquery name="foo" datasource="#request.mainDSN#">
SELECT 0 AS carrier_ID, 'Select a Carrier' AS carrierName, '1' AS
sortName
FROM dual
UNION
SELECT carrier_ID, carrierName, upper(carrierName) AS sortName
FROM carrier
ORDER BY sortName
</cfquery>
This is not all that pretty, but it allows the use of CFSELECT the way
you
want.
Since there are only 50 states, however, you are only looking at 5-10
milliseconds difference between using a standard SELECT with CFOUTPUT
and
using CFSELECT.
Why would you want to use CFSELECT then? you ask...
Say you have a page that displays a table with 50 rows and each row has
two
state drop-downs - one for shipping address and one for billing
address.
You would definitely want to use a CFSELECT (or re-think your gui...)
because if you don't you'll end up with an app that won't scale.
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
Telecomunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may
have
peace'..."
- Thomas Paine, The American Crisis
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 19, 2001 11:49 AM
To: CF-Talk
Subject: cfselect question
Does anyone know of a way to display a default field when using
cfselect
and a query first? I've put an option tag between the <cfselect> and
</cfselect> tags and it displays it as the last entry. I would like it
to display first.
What I'm doing is using my states database to populate the select box,
but I want it to default to "Select State" as the very first entry, but
it's showing up last.
<cfselect query="getStates" name="stateid" value="stateid"
display="name">
<option value="0" selected>Select State
</cfselect>
Sorry for such a simple post, but I'm fried and can't think of any way
around putting it in the table itself.
Thanks,
Michael Corrigan
Programmer
Endora Digital Solutions
www.endoradigital.com
630/942-5211 x-134
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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