CFSELECT bind to query with "selected" value

Posted on 2007-10-17
Last Modified: 2013-12-24
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).
Question by:mpsautomationteam
    LVL 9

    Accepted Solution

    Check out here:

    and here (for multis):

    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.

    Author Comment

    Thank you, it works. It's ashame it's not an out of the box feature.
    LVL 9

    Expert Comment

    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.

    Expert Comment

    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.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now