0

It seems jQuery validation plugin only supports validation rules for submission check. What if I want callbacks instead of submission when certain rules are satisfied, how can this be done in the plugin?

For e.g. I might want to display a message if every field in the form is filled, and another message if not. I want to bind this to field change event as well as submission. But as long as a required subset of fields are filled, the form can be submitted regardless of whether every field is filled.

Or is there some library that can do this? Thanks for any help!

4

1 回答 1

1

jquery-validate allows you to supply your own submitHandler, which gets called if the form validates instead of submitting the form. This callback can display a message and then submit the form for real.

Documentation of validate options

于 2013-05-24T08:57:19.457 回答