-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Problem with required field, when type is set #4
Comments
Can you show the full input-filter configuration? I am almost certain the problem lies somewhere else. If this is really a bug then it should be reported at the correct repository: zendframework/zend-inputfilter. Originally posted by @Wilt at zfcampus/zf-content-validation#90 (comment) |
Here it is. Originally posted by @tasselchof at zfcampus/zf-content-validation#90 (comment) |
I have the exact same problem with an identical setup. If you pass boolean true then it's fine. If you don't set the element at all, it's fine (not required after all). But boolean false always triggers {"isEmpty":"Value is required and can't be empty"}. Seems the easiest way around this is to add 'allow_empty' => true to your configuration and condition your data accordingly at the other end. Probably just assume if it aint a boolean true then it's false. Originally posted by @Bombdog at zfcampus/zf-content-validation#90 (comment) |
Hello!
Found such a case - if field is not set to required, but value is set to false:
[ 'required' => false, 'validators' => [], 'filters' => [], 'name' => 'debug', 'field_type' => 'boolean', ]
On request like this:
{"debug":false}
It will give an error:
Originally posted by @tasselchof at zfcampus/zf-content-validation#90
The text was updated successfully, but these errors were encountered: