Empty Array [] won't pass to custom validator
See original GitHub issueValidator.register('fail_array', function(value, requirement, attribute) {
return false;
}, ':attribute Failed');
var fields = {attr: []}
var rules = {attr: 'fail_array'}
new Validator(fields, rules);
This validation will won’t fail. There is use case that I want to check an array should include a value, empty array should fail as well.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Empty Array [] won't pass to custom validator #131 - GitHub
This validation will won't fail. There is use case that I want to check an array should include a value, empty array should...
Read more >Angular FormArray custom validator not firing - Stack Overflow
I want my FormArray to be able to know whether or not any of the FormControls have an email validation error, and if...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
The custom validator Closure receives four arguments: the name of the $attribute being validated, the $value of the attribute, an array of $parameters...
Read more >validate.js
If you don't want to give any options to a validator you may pass true instead of an empty object. The validator will...
Read more >Custom Rules - VeeValidate
You can recieve an object instead of an array for your validation rule by providing a paramNames array in the extend options (third...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Laravel the above fails the validation rule, this seems like a bug.
I require it… because I need to write code that handles soft deletes, like the following: