Groups | Blog | Home
all groups > coldfusion flash integration > february 2006 >

coldfusion flash integration : Select combo box item from script in CF


AdTech
2/2/2006 2:26:54 AM
I have a CF generated flash form that I would like to use to edit address
records. The form has a <cfselect><option> list of states. When the form
opens I do a remote query to retieve an address record from the database. I
can populate the forms' <cfinput> tags from the query, but have not found a way
to select the proper <option> in the <cfselect>. Any hints? Thanks.
Dragonwright
2/7/2006 12:00:00 AM
AdTech
2/10/2006 2:37:54 AM
I can tell you what I finally did to get on with the project. I did a
pre-query to find the data needed to identify the desired <option> tag to
select. Then I used a <cfif> tag to set the option while building the flash
form. This seems a pretty silly way to get there and I need to regenerate the
from for each record. But I needed to move on.
The ScareCrow
2/12/2006 11:28:19 PM
I would assume that the returned address record has a state id ?

Then in the onresult of the remote call, just loop through the cfselect list

Lets assume the select list is called "myselect", then

//bring the form field into scope
var myselect = myselect
//loop through the select list
for(var x=0; x < myselect.length; x++){
if(myselect.getItemAt(x).data == results.getItemAt(0).stateID){
myselect.selectedIndex = x;
}
}

Ken
AdTech
2/24/2006 8:31:34 PM
Good suggestion. I went back to the code to give it a try and have had mixed
success. The basic idea works, however, bringing the <CFSELECT ...> into scope
is iffy. It works properly the first time after I restart the CF server and
about 1 in 10 times after that. There are no problems with any other <CFFORM
....> fields.
Thanks.
AddThis Social Bookmark Button