Skip to main content
Inspiring
November 21, 2022
Answered

CFSELECT QUESTION

  • November 21, 2022
  • 1 reply
  • 415 views

When using htmal select tag I can show a message on the first option attribute to the user, such as: Please select a country :

<fieldset>
<select name="Countries" class="stylebox" id="Country" required>
     <option value="">Select your Country</option>   
    <CFOUTPUT QUERY="GetCountries">
    <option value="#GetCountries.country#">#GetCountries.country#</option>
    </CFOUTPUT>
</select>
</fieldset>

 

Is it possible to do the same thing with cfselect and how? I put down my message in the message attribute of cfselect but it doesn't work. Here is my code:

<fieldset>
<cfselect name="Countries" query="GetCountries" value="Country" required="True" multiple="No" size="1" class="stylebox" ></cfselect>
</fieldset>

 

    This topic has been closed for replies.
    Correct answer mega_L

    Found the answer:

    https://forta.com/2004/08/27/cfselect-query-positioning/

    1 reply

    mega_LAuthor
    Inspiring
    November 21, 2022

    I tried adding 

    <cfselect name="Countries" query="GetCountries" value="Country" required="True" multiple="No" size="1" class="stylebox" >

        <option value = "">Select your country</option>

    </cfselect>

     

    It works but this appear on the bottom most of the list where user don't see it immediately. How to get this option listed on top. 

    mega_LAuthorCorrect answer
    Inspiring
    November 21, 2022
    BKBK
    Community Expert
    Community Expert
    November 22, 2022

    Let me confirm the answer, to assist anyone who comes here with the same question. Just add the cfselect attribute,  

    queryPosition="below"