简体   繁体   中英

How to trigger validation before submission in parsley?

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?

You'll need to use data-parsley-trigger="keyup" ( http://parsleyjs.org/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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM