Skip to main content
Known Participant
October 26, 2010
Question

<cfselect> with Required="Yes" not working

  • October 26, 2010
  • 1 reply
  • 1442 views

I have this cfselect:

<CFSELECT name="country" SIZE="1" REQUIRED="Yes" message = "Please select a country">
                  <OPTION value=" ">Choose a Country</OPTION>
                  <OPTION VALUE="AF">Afghanistan [AF]</OPTION>
                 <OPTION VALUE="AL">Albania [AL]</OPTION>
                 <OPTION VALUE="DZ">Algeria [DZ]</OPTION>
               etc.

                 </CFSELECT>

However, according to CF8 manual on the Required parameter:

Note: This attribute has no effect if you omit the size attribute or set it to 1, because the browser always submits the  displayed item. You can work around this issue: format forms by having  an initial option tag with value=" " (notice the space character between the quotation marks).

  • yes: a list element must be selected when the form is submitted.
  • no

I tried to "work around" with and without the SIZE but CF still will NOT detect that the user did not select a country. What is wrong?   The screen displays Choose a Country and it will pass.

    This topic has been closed for replies.

    1 reply

    October 26, 2010
    jackhuangAuthor
    Known Participant
    October 27, 2010

    The extra javascript kind of worked but it will show blank in the list.  Right now I have "Choose a Country" as the first item and I want it showing.  The instruction given says  "You can work around this issue: format forms by having an initial option tag with value=" "  That is exactly what I have for the entry "Choose a Country", the value of which is " ".   What is Adobe saying "work around this issue"?  It isn't a work-around because it is not working.  Am I missing something?