Setup: The webform contains a select component and one of the options in the list is a key of 0 (zero).

Symptom: When the webform is saved to the database and then later edited (either by resuming a draft edit or by editing a submitted form), and when there is no selection for the component, the option with a key of 0 will become selected (even though the user did no such thing).

Reason: A "no value selected" value is stored in the database as an empty string. When an empty string is used as the '#default_value' for a radios form element and one of the options has a 0, that option is selected.

Solution: When setting the '#default_value', convert any empty strings to NULL.

Fixed and committed to 7.x-4.x and 8.x

Comments

  • Commit 105bec8 on 7.x-4.x by DanChadwick:
    Issue #2286429 by DanChadwick: Fixed mis-defaulting of empty select...
  • Commit 9769910 on 8.x-4.x by DanChadwick:
    Issue #2286429 by DanChadwick: Fixed mis-defaulting of empty select...
danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Issue summary: View changes
Status: Active » Fixed
StatusFileSize
new1.17 KB

Status: Fixed » Closed (fixed)

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

danchadwick’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev