Skip to main content
Participating Frequently
January 31, 2013
Question

CFSELECT getting ELEMENT is undefined in FORM

  • January 31, 2013
  • 1 reply
  • 1723 views

Found quite a few items on this topic when searching the web, but nothing applied.

I have a CFSELECT that searches a database for the options, and has its own blank option.  On the cfselect i have a selected="". When I display the form, the selected isn't highlighted.  If I don't highlight something on the field, when I click the submit button, that form field is not sent (doesn't appear in the CFDUMP.   If I select the option value and press submit, it then gets passed.

  




<cfselect name="Position_Club"







required="No"







message="Please assign Club Position"







size="4"







selected=""







query="get_DropDownPositionClub"







Display="Position"







Value="Position_Code"







queryPosition="below"







Multiple="Yes">







<option value="">None</option>






</cfselect>

Around this code I placed another cfselect with all the option values, and they do go into the form when I press select.  Before I update the code, it was using flash HTML and it worked fine.  It looked like:






<cfformgroup type="horizontal" label="Club Position(s)">


  




<cfselect name="Position_Club"







required="No"







message="Please assign Club Position"







size="4"







query="get_DropDownPositionClub"







selected=""







Display="Position"







Value="Position_Code"







queryPosition="below"







width="300"







Multiple="Yes">







<option value = ""> None






</cfselect>

Code any ideas?

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    January 31, 2013

    The selected attribute should be a non-empty string. Setting the it to "" runs counter to what ColdFusion expects. The documentation on cfselect says this about the attribute:

    "One or more option values to preselect in the selection list. To specify multiple values, use a comma-delimited list. This attribute applies only if selection list items are generated from a query. The cfform tag preserveData attribute can override this value.".