Skip to main content
Inspiring
April 4, 2010
Answered

cfselect bound to query w/o initial value?

  • April 4, 2010
  • 1 reply
  • 2256 views

Here's the code:

<cfinvoke component="Functions"

method="GetAllStewards"

returnVariable="AllStewards"

</cfinvoke>

<cfselect Name="NewSteward"

query="AllStewards"

display="FullName"

value="MemberID"

required="No"   

selected=" "

</cfselect>

Here's the problem:  The cfselect always "contains" the MemberID value for the first steward in the list.

Here's what I want:  If the values in the cfselect are not clicked, I want the value in NewSteward to be blank.  How do I do this?

    This topic has been closed for replies.
    Correct answer BKBK

    Introduce a blank option, then use the attribute queryPosition to position the items from the query relative to the blank option

    <cfselect  Name="NewSteward"

    query="AllStewards"

    display="FullName"

    value="MemberID"

    required="No"

    queryPosition="below">

    <option value="your_default_value"></option>

    </cfselect>

    1 reply

    BKBK
    Community Expert
    BKBKCommunity ExpertCorrect answer
    Community Expert
    April 9, 2010

    Introduce a blank option, then use the attribute queryPosition to position the items from the query relative to the blank option

    <cfselect  Name="NewSteward"

    query="AllStewards"

    display="FullName"

    value="MemberID"

    required="No"

    queryPosition="below">

    <option value="your_default_value"></option>

    </cfselect>