Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add beforeFormUnbind callback, fix #372 #566

Merged
merged 1 commit into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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