I don't want to display error messages from ParsleyJS

南楼画角 提交于 2020-01-23 05:35:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!