Skip to content

Commit

Permalink
add beforeFormUnbind callback, fix #372
Browse files Browse the repository at this point in the history
  • Loading branch information
SG5 committed Oct 30, 2019
1 parent 887ee0a commit 882225c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ beforeSubmit: function(arr, $form, options) {
}
````

### beforeFormUnbind
Callback function invoked before form events unbind and bind again. Provides an opportunity to manipulate the form before events will be remounted. The callback is invoked with two arguments: the jQuery wrapped form object and the options object.

````javascript
beforeFormUnbind: function($form, options) {
// your callback code
}
````

### filtering
Callback function invoked before processing fields. This provides a way to filter elements.

Expand Down
4 changes: 4 additions & 0 deletions src/jquery.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,10 @@
return this;
}

if (options.beforeFormUnbind) {
options.beforeFormUnbind(this, options)
}

return this.ajaxFormUnbind()
.on('submit.form-plugin', options, doAjaxSubmit)
.on('click.form-plugin', options, captureSubmittingElement);
Expand Down

0 comments on commit 882225c

Please sign in to comment.