Field's previous default value being used if changed and set value is cleared out
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
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
- Create a Radio Button or Color field type with a default value.
- Add field to an entry.
*Note: if the entry is existing you must set or select the default value for it to be applied. - Test to see default value is returned in entry's Twig output.
- Change the field's default value.
- Edit the entry from step 2, and see that the value is missing.
- Test to see that the previous default value is still returned in entry's Twig output.
Additional info
- Craft version: 3.1.4
- PHP version: 7.1.12
- Database driver & version: MySQL 5.6.38
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the problem with Radio Button and Color fields using the listed steps, then trace the field default handling during entry editing and Twig output. Done means changing a field’s default no longer leaves the previous value in output and the entry’s value is not blank when edited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100