Webform has custom code for handling a select list that is mandatory but has no default value. It adds "Select..." as an option with an empty string for its value. D7 handles this case already for select elements so a custom implementation is not needed.

Comments

james.elliott’s picture

Title: Webform does not need to have custom handling for required select lists that are mandatory with no default value » Webform has a redundant implementation for mandatory select lists with no default value
quicksketch’s picture

Hmm, unbelievably Drupal 7 seems to handle an opposite situation, where it only adds "- Select -" if the element is NOT required and default NOT is provided. Webform currently adds "select..." if the element IS required and a default is NOT provided. Strangely Drupal 7 does not add "- Select -" in the same scenario that Webform handles. Honestly I'm not really sure which approach makes more sense.

quicksketch’s picture

I reviewed this one again and I see what's going on here. Core handles both required and not-required fields, it just gives different labels depending on whether a field is required or not. Since Webform already contains the IS required condition, it seemed like core only auto-provided the NOT required condition (since it didn't double-up the required option if not needed). I'm giving this another review.

Also of interest to this issue is #799670: Translatability issue with "select...", which argues that "- Please select -" should be used over "Select..." (noting that Drupal core prefers just "- Select -" with no "Please ").

quicksketch’s picture

StatusFileSize
new13.87 KB
new11.68 KB

I've committed these patches that make the suggested change to D7 plus removal of unnecessary translation strings. In D6, I've backported the D7 behaviors and appearance, adding the "- None -" option for non-required fields and changed "select..." to "- Select -" for required fields.

quicksketch’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.