Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve number field: allow empty/null, add defaultValue #2886

Merged
merged 3 commits into from
May 15, 2018
Merged

Improve number field: allow empty/null, add defaultValue #2886

merged 3 commits into from
May 15, 2018

Conversation

timkelty
Copy link
Contributor

Fixes #988, #927

The number field is much more useful when we allow empty/null values (instead of converting to 0). Disallowing this, should then be done by making the field required, like other fields.

Also added is an optional default value for fresh elements.

/cc @lindseydiloreto

@brandonkelly brandonkelly merged commit 746962a into craftcms:develop May 15, 2018
brandonkelly added a commit that referenced this pull request May 15, 2018
@brandonkelly
Copy link
Member

Merged, thanks! Though in my testing, Number fields were already able to save as null when left blank.

@timkelty
Copy link
Contributor Author

Though in my testing, Number fields were already able to save as null when left blank.

Ah ya know what - it did work if you happened to not specify any decimals places. If you did, it would save a blank as 0.00

@timkelty timkelty deleted the 988-number-field-allow-null branch May 16, 2018 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants