Open attenzione opened 10 years ago
Handling of error message is pretty simplistic, so that's not possible without a different validator.
I would accept a PR for an exact-length
validator, say, to be put in extra/validator
if you feel up for it!
I think you are wrong, because you allow exact length, but the message is incorrect
:smile: The message is sounds odd for sure, but it isn't incorrect in the strictest sense. The issue is really that it's best to keep the error messages simple, for i18n & al.
You realize that you can easily specify an error message for that particular field with parsley-length-error-message
, right?
Not exactly, but this solution could exist, like common, for all validators. But I thought about two different messages in i18n, validator choose, which one is displayed
It's true that this already exists for type
, so could be made more generic.
@marcandre this is slightly off-topic, but how would you feel about having the length
validator match exact length and create a new validator like length-range
which would get length
's current behavior?
Edit: Submitted a PR to ValidatorJS which demonstrates this
this would helpful for me, if i could to like this
data-parsley-length="10"
, corresponding message should be changed (This value length is invalid. It should be between %s and %s characters long.
without between), but of course should keep both messagesi know, that i can create my validation, but i think it should be possible with build-in length validation