macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

cfselect data binding with statically defined options

Subject: cfselect data binding with statically defined options
From: "C. Doak"
Date: Tue, 14 Aug 2007 18:32:38 +0000 UTC
Newsgroups: macromedia.coldfusion.cfml_general_discussion
I am having some trouble getting statically defined options to remain in my 
cfselects when I use binding in CF8

 I have four cfselects: Continent, Country, State/Province, County
 The continent select is populated by a list in a database, and each subsequent 
select is populated depending on the continent value (your run-of-the-mill 
related select box model).

 I have a form that allows a user to edit an existing record that uses these 
select boxes.  The form is populated with data from that existing record - for 
example, a record in which Continent=North America, Country=United States, 
State=Montana, and County=Meagher

 The problem is that when I define a static option based on what's already in 
the database:

 <cfselect name="continentSelect" bind="cfc:CF_Classes.places.getContinents()" 
bindonload="true">
      <option value="#[i]defined continent name[/i]#" 
selected="selected">[i]defined continent name[/i]</option>
 </cfselect>

 the static option is displayed only momentarily while the query is running and 
then disappears completely from the box once the box is populated.  I have got 
the option to stay when I turn "bindonload" off, but even then when I trigger 
the binding the option disappears.  I have been able to get it to stay when I 
use the old method of defining a query to populate the box, but then I lose the 
binding ability in subsequent boxes so that options I don't want to show are 
displayed (i.e. something like Continent=North America, Country=Japan).

 Maybe there isn't a way around this, but there is an example of this type of 
thing in the CFML reference for CF8.  I haven't tested it so I don't know if 
that one works or not.  Am I missing something?


<Prev in Thread] Current Thread [Next in Thread>
  • cfselect data binding with statically defined options, C. Doak <=