craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.26k stars 633 forks source link

Field's previous default value being used if changed and set value is cleared out #3734

Open vonscriptor opened 5 years ago

vonscriptor commented 5 years ago

Description

Tested with Radio Button and Color field types. Might be an issue with other fields with default values.

When a field is using a default value and that default value is then changed, the previous default value is still used when output in Twig.

Also, the values are then unselected/blank when editing an entry that uses the field and default value.

Steps to reproduce

  1. Create a Radio Button or Color field type with a default value.
  2. Add field to an entry. *Note: if the entry is existing you must set or select the default value for it to be applied.
  3. Test to see default value is returned in entry's Twig output.
  4. Change the field's default value.
  5. Edit the entry from step 2, and see that the value is missing.
  6. Test to see that the previous default value is still returned in entry's Twig output.

Additional info

brandonkelly commented 5 years ago

It’s an issue for all non-relational field types, which are storing static text in the database rather than foreign keys to some centralized value table.