-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brian,
Best way would be to keep the list of states in a database... and
then you could have code like this:
<!--- get all the states here --->
<cfquery name="getstates" datasource="#dsn#">
SELECT id, state
FROM states
</cfquery>
<!--- get your users info here --->
<cfquery name="getuser" datasource="#dsn">
SELECT first_name, last_name, stateid
FROM users
WHERE id = #someid#
</cfquery>
<select name="state">
<cfoutput query="getstates">
<option value="#id#" <cfif id EQ getuser.stateid>selected>
</cfoutput>
</select>
Aaron Johnson, MCSE, MCP+I
Allaire Certified ColdFusion Developer
MINDSEYE, Inc.
<phn>617.350.0339
<fax>617.350.8884
<icq>66172567
[EMAIL PROTECTED]
___________________________________________
"Never forget that only dead fish swim with
the stream." -- Malcolm Muggeridge
___________________________________________
- -----Original Message-----
From: Brian Ivey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 14, 2000 3:48 PM
To: CF-Talk
Subject: Repopulating combo ( or select) boxes
Dear List,
I am working on a form where a user can modify their account
information.
This information contains their state, country, etc. You know the
standard
stuff. If the user was from South Carolina, I only save SC or some
number
representing South Carolina.
Now here is my question. If I have a something like:
<select name="state">
<option value="1">South Carolina
<option value="2">Georgia
...
<option value="n">some name
</select>
and I am only saving 1 for South Carolina, 2 for Georgia, etc. Is
there an
easy way to repopulate this data. So when I go to reload the record
and I
have a 1 for state. How do I easily/painlessly translate the 1 to
South
Carolina. The only solution I can think of takes about a million
lines of
code and seems very clunky. I would greatly appreciate any advice.
BTW, I
have looked at CFINPUT and have not yet seen how I could make it do
this for
me.
Thanks in advance,
Brian Ivey
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists