I can validate my form by calling $form.validate() and $form.valid(). And so presumably these functions are called automatically when submitting a form.
But my question is: If I have a custom validation function, how can I cause it to be called automatically when these validation methods are called? That is, I want my validation function to be called when the form is submitted, but also if $form.validate() and $form.valid() are called manually.
$form.validate()is the initialization method for the entire form.$form.valid()is the programmatic trigger for validation of the entire form. They are not the same. After the plugin is initialized,.valid()can be used to programmatically trigger validation on the form or an individual field depending on the jQuery selector target. Otherwise, validation is always automatically triggered on the submit button by default. If your custom rule or method is not being called, that would be something other issue entirely.