Closed iamkeir closed 1 year ago
Interestingly, if you switch to using data-parsley-minlength
/data-parsley-maxlength
instead of minlength
/maxlength
, it works as expected.
Thanks for the report, I completely see how this can be seen as a bug.
What's happening is that you are meant to be using data-parsley-length
validator instead of data-parsley-minlength
/data-parsley-maxlength
. It produces a better error message.
There is no HTML5-builtin equivalent, so Parsley does that for you if you use minlength
+ maxlength
.
I guess that Parsley could do the same for data-parsley-minlength
/data-parsley-maxlength
, or some odd mix of min length
+ data-parsley-maxlength
, but I'm not convinced there's a good reason to accept that.
What I've done is made the documentation more explicit about it.
@marcandre thanks for fast response, and fair enough - just raising the inconsistency that caught me out.
Using
minlength
anddata-parsley-minlength-message
, ormaxlength
anddata-parsley-maxlength-message
outputs the custom error message correctly. However, if you use both on a single field, it ignores the custom error messages and instead outputs the default message in Parsley.See here: https://codepen.io/iamkeir/pen/mdLzXRX?editors=101