Erika,
You don't preselect it. You just make the record in the database the first item of
the select list.
Use the following code:
<cfparam name="parked" default="0">
<!---
note: set the variable "parked" to whatever the number should be, based upon your edit
query
for example:
<cfset parked = myquery.parked>
--->
<cfset parked = 4>
<select name="parked">
<cfif parked eq 0>
<option value="">
<cfelse>
<cfoutput>
<option value="#parked# week/year">#parked# week/year
</cfoutput>
</cfif>
<cfloop index=i from="1" to="52">
<cfoutput>
<option value="#i# week/year">#i# week/year
</cfoutput>
</cfloop>
</select>
--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Efax.com Fax: (801) 730-7289
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------
> -----Original Message-----
> From: Erika Foster [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 27, 2000 1:10 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Selecting a value in a dropdown.
>
>
> Mark,
>
> I'm not sure I understand.
>
> This form is serving as an edit or insert action, so I'd like to have this
> field pre-selected with the value of that field that is in the DB for that
> record. I also still want the 52-week dropdown option in case the user
> needs to edit the information for that record.
>
> I used the #iif(....)# option and it worked nicely. But if you know of a
> way thats even simpler, I'm all ears (eyes).
>
> Erika
> ----- Original Message -----
> From: "Mark Warrick" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 27, 2000 12:38 PM
> Subject: RE: Selecting a value in a dropdown.
>
>
> You can cut it down even more by skipping the 52-week nested CFIF loop and
> outputting the data as the first item on the option list.
>
> ---mark
>
>
> --------------------------------------------------------------
> Mark Warrick
> Phone: (714) 547-5386
> Efax.com Fax: (801) 730-7289
> Personal Email: [EMAIL PROTECTED]
> Personal URL: http://www.warrick.net
> Business Email: [EMAIL PROTECTED]
> Business URL: http://www.fusioneers.com
> ICQ: 346566
> --------------------------------------------------------------
>
>
> > -----Original Message-----
> > From: Brian Peddle [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 27, 2000 10:38 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: Selecting a value in a dropdown.
> >
> >
> > You can cut that down even more to just use 1 if around the selected:
> >
> > <option value="#i# week/year" <CFIF Query.DatabaseValue IS
> > i>SELECTED</cfif>>#i#week/year</option>
> >
> >
> > -----Original Message-----
> > From: Roberts, Jesse D [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 27, 2000 11:16 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: Selecting a value in a dropdown.
> >
> >
> > Embed a CFIF statement inside the loop that determines whether
> or not the
> > database value matches the <OPTION> value. Then, if it does
> > match, include
> > the SELECTED parameter inside the option tag.
> >
> > <select name="parked">
> > <option value="">
> > <cfloop index=i from="1" to="52">
> > <CFIF Query.DatabaseValue IS i>
> > <option value="#i# week/year" SELECTED>#i#
> > week/year
> > <CFELSE>
> > <option value="#i# week/year">#i# week/year
> > </CFIF>
> > </cfloop>
> > </select>
> >
> > Keep in mind that this will only work if there is only one
> possible match
> > between the database values and your index (i).
> >
> > Jesse D. Roberts
> > Business Process Analyst
> > Procurement Quality Assurance
> > Boeing - Huntington Beach, CA
> > [EMAIL PROTECTED]
> > Ph. 714-896-3462
> > Fx. 714-896-3303
> >
> > > -----Original Message-----
> > > From: Erika Foster [SMTP:[EMAIL PROTECTED]]
> > > Sent: Tuesday, June 27, 2000 7:24 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Selecting a value in a dropdown.
> > >
> > > I am populating a select input field with a <cfloop>
> > >
> > > <select name="parked">
> > > <option value="">
> > > <cfloop index=i from="1" to="52">
> > > <option value="#i# week/year">#i# week/year
> > > </cfloop>
> > > </select>
> > >
> > > That's all working. This form is also an edit form if a
> record already
> > > exists for this facility. How do I pre-select the value that
> is in the
> > > database for that record from within the loop?
> > >
> > > Thanks,
> > >
> > >
> > > Erika Foster
> > > engineering-environmental Management
> > > Applications Developer
> > > (505) 866-1654
> > > [EMAIL PROTECTED]
> > >
> > >
> >
> --------------------------------------------------------------------------
> > > ----
> > > Archives: http://www.eGroups.com/list/cf-talk
> > > To Unsubscribe visit
> > >
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> > send a message to [EMAIL PROTECTED] with
> 'unsubscribe' in
> > the body.
> ------------------------------------------------------------------
> ----------
> --
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
>
> ------------------------------------------------------------------
> ----------
> --
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
>
> ------------------------------------------------------------------
> ----------
> --
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=sts&body=sts/cf_tal
k or send
a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.