CFSELECT bind to query with "selected" value

I am using bind to pull data into a select list, which then binds another select list to display drilled down results. I am unable to use the "selected" value in the cfselect. I want to be able to allow the user to return to the form and have the last selected results display. Here is my code:

<cfselect name="orgid" style="width:600px;" value="orgid" display="fullorg" selected="#form.orgid#" bind="cfc:lib.cfc.orgoffice.qryOrg()" bindonload="true" />

<cfselect name="officeid" size="5" style="width:600px;" multiple="yes" value="officeid" display="fulloffice" selected="#form.officeid#" bind="cfc:lib.cfc.orgoffice.qryOffice({orgid})" bindonload="true" />

The binding works fine, just the "selected" doesn't display the form.orgid value (same for the second one).
mpsautomationteamAsked:
Who is Participating?
 
digicidalConnect With a Mentor Commented:
Check out here:
http://www.coldfusionjedi.com/index.cfm/2007/8/7/Selecting-default-items-using-ColdFusion-8s-AJAX-Controls

and here (for multis):
http://cfsilence.com/blog/client/index.cfm/2007/8/7/Selecting-Multiple-Default-Items-With-ColdFusion-8-Ajax-Controls

Essentially you should be able to tweak this so that you first get your passed form value and then resort so that it is the selected default - or don't do the resort if the form value does not exist.

That's all I can think of or find at the moment.  Good luck, and hopefully someone else has had more time to play with CFAJAX or spry or similar to maybe suggest a better solution.
0
 
mpsautomationteamAuthor Commented:
Thank you, it works. It's ashame it's not an out of the box feature.
0
 
digicidalCommented:
Yes, unfortunately that is almost always the 'growing pains' associated with developing 'bleeding-edge' solutions.  As I have found over the past 4 versions of CF (and application development in general) - it will take only about 4 weeks longer than you have in any given project for a new version or update to be released which will provide the features that you require.

I've done some more searching, and I can't find or come up with anything simpler - I'm glad, however, that at least this did work for you.

Good luck.
0
 
sportsmansCommented:
I would suggest another attribute for the cfselect tag like:
' bindSelected="#result.value# " to replace  ' selected="#result.value#" '
It would be a nice addition if it hasn't already been added in CF9.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.