Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CFSelect - Bind - Selected

Guest
Jul 16, 2009 Jul 16, 2009

Lets say that I have the following:

<cfselect name="city" value="unid" display="city" bind="cfc:Examples.CFC.Geographic.getAllCities()" bindonload="true" onChange="submit()"  />

This will return all the countries in our system. When the form submits onChange, the value changes to the city at the top of the list.

How do I get the cfselect to default to the value selected when it was previously changed ?

TOPICS
Getting started
4.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 16, 2009 Jul 16, 2009

use the selected attribute

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 16, 2009 Jul 16, 2009

I attempt to pass a variable as the selected value, it always defaults to the top value returned from the cfc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 16, 2009 Jul 16, 2009

Is the variable you are passing one of the available values?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 16, 2009 Jul 16, 2009

Yes

I can try again when I get home. So the Selected should work ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 10, 2009 Aug 10, 2009

You are not crazy...it does NOT work.  I have seen some solutions that required putting the selected item at the top of the list and another that rewrote the Ajax.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2009 Aug 19, 2009
LATEST
How do I get the cfselect to default to the value selected when it was previously changed ?

<cfform preservedata="yes">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources