Closed sunupf closed 9 years ago
Laravel probably is returning both errors, but you only see the first one.
yeah I was thought that, that's why I'm asking why not place the required error first then character length.
But, after try some validation, I believe laravel just return required error, without character length error. I was check it using dd()
Well you are adding the required
rule last so why would it be the first error? Really confused.
Yeah I know that :) . But on validatorjs npm page, validatorjs said "Validation library based on Laravel's Validator class" and laravel will return required error first even we add it at the last place and just return required message.
But if it's how validatorjs work on validation (a little bit different than laravel) then it's ok
Ha, well your right it's not entirely a complete rewrite/clone of Laravels validator so there will be some differences. I've actually updated the npm description so it more accurately reflects the "inspired" type theme.
I personally always put the order of most important validations left to right. I have been thinking about adding a stopOnFirstError
type option as well, as generally you output the first for each field rather than list them all, might increase performance a bit.
Ya, that option will be nice.
So I''ll close this issue. I think it's not an issue anymore :).
Thank you.
In laravel when I create rule
and I just fill the name input with space it's return "The name field is required."
In validatorjs when I create rule
then I fill the name input with space it's return
I think the first error should be "the name field is required", isn't?