ソースを参照

#105: Cannot call form.submit() inside submitHandler

nghuuphuoc 11 年 前
コミット
92fc9e1c80

+ 2 - 1
CHANGELOG.md

@@ -6,7 +6,8 @@ Not released yet
 
 __Fixes__:
 
-[#77, #117: ```notEmpty``` validator doesn't work on file input](https://github.com/nghuuphuoc/bootstrapvalidator/issues/117)
+* [#77, #117: ```notEmpty``` validator doesn't work on file input](https://github.com/nghuuphuoc/bootstrapvalidator/issues/117)
+* [#105: Cannot call ```form.submit()``` inside ```submitHandler```](https://github.com/nghuuphuoc/bootstrapvalidator/issues/105)
 
 ## v0.3.2
 

+ 1 - 1
demo/submitHandler.html

@@ -20,7 +20,7 @@
                     <h2>Custom submit handler</h2>
                 </div>
 
-                <form id="defaultForm" method="post" class="form-horizontal">
+                <form id="defaultForm" method="post" class="form-horizontal" action="target.php">
                     <div class="alert alert-success" style="display: none;"></div>
 
                     <div class="form-group">

+ 2 - 0
dist/js/bootstrapValidator.js

@@ -275,6 +275,8 @@
 
             // Call the custom submission if enabled
             if (this.options.submitHandler && 'function' == typeof this.options.submitHandler) {
+                // Turn off the submit handler, so user can call form.submit() inside their submitHandler method
+                this.$form.off('submit.bootstrapValidator');
                 this.options.submitHandler.call(this, this, this.$form, this.$submitButton);
             } else {
                 // Submit form

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 2 - 0
src/js/bootstrapValidator.js

@@ -274,6 +274,8 @@
 
             // Call the custom submission if enabled
             if (this.options.submitHandler && 'function' == typeof this.options.submitHandler) {
+                // Turn off the submit handler, so user can call form.submit() inside their submitHandler method
+                this.$form.off('submit.bootstrapValidator');
                 this.options.submitHandler.call(this, this, this.$form, this.$submitButton);
             } else {
                 // Submit form