House of Fusion
Home of the ColdFusion Community
Hostmysite Dedicated Hosting

Search cf-talk

September 06, 2008

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30         

Subscribe Now
Fusion Authority Quarterly Update - ColdFusion 8 Special Edition

For ColdFusion hosting try HostMySite.com.
Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  ColdFusion Talk (CF-Talk)

Dynamically prepolate the select box

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
erik tom
05/09/2008 01:18 PM

I am dynamically buildin a select box . How can i prepopluate the data so when it loads it will select the previously submited answer So far i got this <cfset selectOptions = selectOptions & '<option value="#options#_#id#"<cfif qryAnswers.answer eq #id#>selected</cfif>>#options#</option>'>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Niski, Brian
05/09/2008 01:32 PM

Hi Erik, As I see it, there is more than one way to prepare your select box.  At a quick glance you look headed in the right direction.  Here is an alternative example of how I have done it... <SELECT id="aname" name="aname">   <OPTION VALUE="-1">Select Something</OPTION>   <CFLOOP QUERY="ItemQ">     <CFIF PredeterminedValue EQ Item_ID>       <OPTION VALUE="#Item_ID#" selected="selected">       #Item#</OPTION>     <CFELSE>       <OPTION VALUE="#Item_ID#">#Item#</OPTION>     </CFIF>   </CFLOOP> </SELECT> Brian I am dynamically buildin a select box . How can i prepopluate the data so when it loads it will select the previously submited answer So far i got this <cfset selectOptions = selectOptions & '<option value="#options#_#id#"<cfif qryAnswers.answer eq #id#>selected</cfif>>#options#</option>'>

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dominic Watson
05/09/2008 01:49 PM

Another option is the iif() function ('inline if'). So: <cfloop query="ItemQ">      <option value="#Item_ID#" #iif(item_ID EQ selectedId, DE('selected="selected"'), DE(''))#>             #Item#      </option> </cfloop> Dominic -- Blog it up: http://fusion.dominicwatson.co.uk

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby Hartsfield
05/09/2008 02:01 PM

Chapter 1: <option value="#Item_ID#"<cfif item_ID EQ selectedId> selected="selected"</cfif>> .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com Another option is the iif() function ('inline if'). So: <cfloop query="ItemQ">      <option value="#Item_ID#" #iif(item_ID EQ selectedId, DE('selected="selected"'), DE(''))#>             #Item#      </option> </cfloop> Dominic -- Blog it up: http://fusion.dominicwatson.co.uk

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peterson, Chris
05/12/2008 07:42 AM

I am really surprised nobody mentioned using a <cfselect selected="valueToBeSelected" query="queryName" value="columnName" /> Chris Peterson Literally. http://www.amazon.com/Adobe-ColdFusion-Web-Application-Construction/dp/0 32151548X/ On Fri, May 9, 2008 at 2:00 PM, Bobby Hartsfield <bobby@acoderslife.com> wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Brian Kotek
05/12/2008 09:36 AM

Normally I'd agree, Chris. But since that is covered by the docs as well as being something that would be explained completely in the first few chapters of any book on the subject, I assume most folks would think it was a given. Unfortunately, since Erik won't actually read the documentation or read a book on this, he'll have to keep asking questions that he could answer himself if he were to expend any effort at all in learning. The irony is, of course, that in the time he's wasted posing these questions to the list, he could already have read about all of this and have a full understanding of it! This truly is a case of "give a man a fish and feed him for a day, but teach a man to fish and feed him for a lifetime." Sigh. On Mon, May 12, 2008 at 7:39 AM, Peterson, Chris < cpeterson@gts.gaineycorp.com> wrote: > I am really surprised nobody mentioned using a <cfselect > selected="valueToBeSelected" query="queryName" value="columnName" /> > > Chris Peterson > >

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Richard Dillman
05/12/2008 10:59 AM

I thought it was "Give a man a fish and you have fed him for today.  Teach a man to fish, and he will sit in the boat and drink beer all day." -- -- Richard Dillman rdillman@gmail.com "There are painters who transform the sun to a yellow spot, but there are others who with the help of their art and their intelligence, transform a yellow spot into the sun." - Pablo Picasso

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group

<< Previous Thread Today's Threads Next Thread >>

Mailing Lists