Skip to main content
Participant
May 4, 2010
Answered

Refresh cfselect

  • May 4, 2010
  • 1 reply
  • 2589 views

Good morning,

I've been searching for days for an answer to my problem: When new items are added to a cfselect, how do I refresh a cfselect without refreshing the whole page?

myform1.cfm, has two, related select boxes:

<cfselect name="collectedgenus"
                bind="cfc:genus_species.getGenus()"
                bindonload="true"
                display="genus"
/>
               
          <cfselect name="species"
                bind="cfc:genus_species.getSpecies({collectedgenus})"
                value="rid"
                size="3"
               
                />

"collectedgenus" shows only the genus ie. Crassostrea, Pfiesteria, etc.  When a genus is selected from "collectedgenus" then "species" is populated with the related genus/species information.  For example, if Crassostrea is selected from "collectedgenus", "species" will show Crassoastrea virginia, Crassoastrea arikensis, etc.

If the desired "species" isn't found, the user can add a new record.  The user clicks a button that opens a pop-up form (mypopup1.cfm).  This form contains a drop down box for "genus" and a text box for the entry of the species name.  So, the user needs to select a genus from the "genus" box, then type in the new species name.  If the desired genus doesn't appear in the "genus" box, the user can click a button (on mypopup1.cfm) that opens a pop-up form (mypopup_genus.cfm), that allows a new genus to be entered.

The problem is that "collectedgenus" on myform1.cfm won't show the new genus unless I refresh myform1.cfm.  Otherwise, everything works beautifully.

Guidance on solving this problem will be very, very, very much appreciated!!!!


    This topic has been closed for replies.
    Correct answer -__cfSearching__-

    Here are two undocumented options

    http://cfsilence.com/blog/client/index.cfm/2007/10/22/Refreshing-A-Bound-CFSelect

    http://cfsearching.blogspot.com/2010/02/coldfusion-9-yet-another-way-to-refresh.html

    1 reply

    -__cfSearching__-Correct answer
    Inspiring
    May 4, 2010

    Here are two undocumented options

    http://cfsilence.com/blog/client/index.cfm/2007/10/22/Refreshing-A-Bound-CFSelect

    http://cfsearching.blogspot.com/2010/02/coldfusion-9-yet-another-way-to-refresh.html

    DNAPrimerAuthor
    Participant
    May 5, 2010

    Thanks for the reply.  I visited the links that you posted, but I cannot figure out how to make the solutions work.  I posted a comment on http://cfsearching.blogspot.com/2010/02/coldfusion-9-yet-another-way-to-refresh.html.  The comment may not appear yet.  But anyway, any help will be appreciated.  If only there were a working example somewhere, then I could probably figure it out.  I'm still learning!

    Thanks!!!

    Inspiring
    May 5, 2010

    Just call the javascript code ColdFusion.bindHandlerCache['yourElementID'].call();  to refresh the list.

    BTW: I saw the comment. But code does not show up in the blogger unless it is html escaped.  Can you post the code you have tried here?