-
-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Milestone
Description
Describe the bug
I have a few Blueprint fields with a validate options. I would have expected that empty fields should skip validation (assuming they're not set to required: true). However, empty fields still seem to go through a validation check.
To Reproduce
Steps to reproduce the behavior:
- Add a field to a page blueprint, such as:
someId:
label: Some ID
type: text
validate:
integer
translate: falseor
someCode:
label: Some Code
type: text
minlength: 2
maxlength: 2
validate:
alpha
translate: false- Leave these field blank, but make a change to some other field (to force the Save bar to appear).
- Try to save the page in the Panel.
- Get error saying you need to "enter a valid integer" or "only enter characters between a-z".
Expected behavior
If a field is left empty, then validation should be skipped.
Kirby Version
3.3.5
Desktop (please complete the following information):
- OS: macOS
- Browser: Safari
- Version: 13.1 (15609.1.20.111.8)
Additional context
According to @texnixe, in February:
A field is only validated with a validator if it has input. To enforce input, you have to require it, because otherwise it can be left empty.
It seems like genuinely empty fields (and not required) should skip validation.