问题
i'm using ParsleyJS library to validate my form, but if a field is invalid i only want to apply the error classes but i don't want to display the error messages. If i use the property data-show-errors="false
, then neither the class or the error shows. I used this method of putting display:none
in the css:
ul.parsley-error-list { display:none !important; } ul.parsley-error-list li { display:none !important; }and it works, but i wanted to know if this is the right approach for doing this or if the library has a way to configure it? Thanks!
回答1:
No you're right, there is currently no support for this kind of option, and it would be nice to provide it natively in config.
I'll look into it, or feel free to add it and submit a PR.
Thanks
回答2:
As of version 2.0+ you can disable the error messages with adding:
data-parsley-errors-messages-disabled
attribute to your form input elements. This won't disable the red color marking of the inputs though.
来源:https://stackoverflow.com/questions/18255903/i-dont-want-to-display-error-messages-from-parsleyjs