最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to trigger validation before submission in parsley? - Stack Overflow

programmeradmin7浏览0评论

I'm now using parsley 2 to validate my form, it works fine except this problem: only after you submit your form for the first time, the validation will be triggered when you change your input, but before submission, it will do nothing.

That said, I want to trigger validation before the first submission. How can I achieve this?

I'm now using parsley 2 to validate my form, it works fine except this problem: only after you submit your form for the first time, the validation will be triggered when you change your input, but before submission, it will do nothing.

That said, I want to trigger validation before the first submission. How can I achieve this?

Share Improve this question asked Jul 18, 2014 at 5:45 Sefier TangSefier Tang 7903 gold badges8 silver badges26 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

You'll need to use data-parsley-trigger="keyup"(http://parsleyjs/doc/index.html#psly-ui-for-form) if you want that your fields auto-validates on keyup event.

You could define it field by field, or on the whole form is directly in the <form> tag.

Best

发布评论

评论列表(0)

  1. 暂无评论