Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
According to the webform handbook: "...if the default option is left blank, an option for "- Please select -" will be added automatically for non-required fields and "- Select an option -" for required field."
I have a webform set up with several drop down lists of options (e.g. one that lets a user select Mr., Mrs., Ms., Miss, etc.), and none selected as default. Regardless of whether or not the field is set to be required, the field always displays the first option (Mr.) as the default.
Comments
Comment #1
dejavu1987 CreditAttribution: dejavu1987 commentedI m having the same problem.
Using the same version of Webform (v 7.x-3.11).
It works fine in v 7.x-3.9
Comment #2
colemanw CreditAttribution: colemanw commentedSame here. It seems to be working fine in the 6.x branch, but not in 7.x.
Comment #3
colemanw CreditAttribution: colemanw commentedAside from being broken, I think this logic (as you quoted from the handbook) is a bit off. The addition of "- Please select -" to dropdown lists should not only be dependent on the presence of a default value, but should also be governed by whether or not a field is required. Non-required fields, even if they have a default set, ought to get the "- Please select -", since that's the only way a user can not select an option (and since it's not required, they shouldn't have to).
Comment #4
robokev CreditAttribution: robokev commentedIdeally, you should also be able to specify (override) the prompt that is used. In my case, I want my form to be bilingual since it will be used by both English and French speakers. Therefore, I'd like to override the mandatory "- Select an option -" with something like "- Select / sélectionnez -".
Comment #5
quicksketchThis is being fixed in #1078750: Options for "- Select -" or "- None -" not automatically added.
Comment #6
robokev CreditAttribution: robokev commentedPleased to see this has been resolved in latest version 7.x-3.13. Many thanks!