jzaefferer/jquery-validation — Issue #238: [enhancement ] Add 'oncreate' option in settings and an event 'form-validation-created'
Author: tw2080
Created: 2011-10-21 08:06:50+00:00
State: open

It is very useful to create a mechanism for adding pligins or executing other initialisations during create time.
This can be done simply by adding the following code just before return statement in main 'validate' method at line 93.

if( $.isFunction(validator.settings.oncreate)){
validator.settings.oncreate(validator);
}
$('body').trigger('form-validation-created', [validator]);

Then in the validation settings structure we can have:

{
...
oncreate : function(validator){
...
}
}