Ask a Question related to Coldfusion Database Access, Design and Development.
-
sage703 #1
Listbox, CFOUTPUT, and CFLOOP
I'm trying to create a form to update a record. This record is already saved in
the DB of course, so all the fields already have values. I'm able to have most
of my listboxes show the value that is currently saved for a record as the
default. However, I'm unsure how to make a listbox that uses a <cfloop> to loop
through a list variable to populate the listbox show the value that is saved
for that record. Here's the code:
<select name="Location_State">
<cfoutput>
<option value=""></option>
<cfloop list="#states#" index="i">
<option value="#i#">#i#</option>
</cfloop>
</cfoutput>
For example, if a record has CA saved as the state in question, I want that
value to show up in the listbox as the currently selected value when you go to
update the record. The way it is now (see the above code) the blank option is
the default.
Anyone familiar with coldfusion forms?
Thanks,
S./
sage703 Guest
-
concat cfloop index to cfoutput variable inside loop?
Hi, STUPID question here: I have a cfloop, index j. I have a text field, DESCRIPTION_#j#, inside the loop. I want to populate the VALUE of the... -
cfoutput and cfloop
Hi all, well this is my question: I want to show 2 or more different sets of record sets but one or more of them have to be nested on the first,... -
click listbox and refresh another listbox
Can someone guide me to a resource on building set of drill-down listboxes? Basically I want to have 4 listboxes. The first starts out with... -
Item label displays as "," when moving from listbox to listbox
I have 2 listboxes: "lb_unselected" and "lb_selected". The first thing in the actions is loop through an array populating these two listboxes. ... -
now desparate! - 1st listbox contents disappears when 2nd listbox appears?
On 23 Jun 2003 12:57:45 -0700, KathyBurke40@attbi.com (KathyB) wrote: Its been a while since you posted but I will answer anyway. The problem... -
mxstu #2
Re: Listbox, CFOUTPUT, and CFLOOP
...
<cfset savedState = "IL">
<select name="Location_State">
<cfoutput>
<option value=""></option>
<cfloop list="#states#" index="i">
<option value="#i#" <cfif i eq savedState>selected</cfif>>#i#</option>
</cfloop>
</cfoutput>
</select>
mxstu Guest
-
sage703 #3
Re: Listbox, CFOUTPUT, and CFLOOP
Thanks mxstu,
I actually found another way to do it right after I posted the thread:
<select name="Location_State">
<cfoutput>
<option value=""></option>
<cfloop list="#states#" index="i">
<option value="#i#" <cfif programs.Location_State IS
i>SELECTED</cfif>>#i#</option>
</cfloop>
</cfoutput>
</select>
sage703 Guest
-
mxstu #4
Re: Listbox, CFOUTPUT, and CFLOOP
Glad you found your solution. Yes, in CF the IS is synonymous with EQ so the statement "... somevalue IS i" is the same as saying "somevalue EQ i".
mxstu Guest



Reply With Quote

