Browse Source

Restore changes discussed in issue #105 - Don't auto-submit a form if it's valid and has no submit button.

https://github.com/nghuuphuoc/bootstrapvalidator/issues/106
James Ford 11 years ago
parent
commit
c12d931eeb
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/js/bootstrapValidator.js

+ 4 - 2
src/js/bootstrapValidator.js

@@ -854,7 +854,9 @@ if (typeof jQuery === 'undefined') {
                 this.validateField(field);
             }
 
-            this._submit();
+            if (this.$submitButton) {
+                this._submit();
+            }
             this._submitIfValid = true;
 
             return this;
@@ -935,7 +937,7 @@ if (typeof jQuery === 'undefined') {
 
                             that.updateStatus(updateAll ? $f.attr('data-bv-field') : $f, response.valid ? that.STATUS_VALID : that.STATUS_INVALID, v);
 
-                            if (response.valid && that._submitIfValid === true) {
+                            if (response.valid && that._submitIfValid === true && that.$submitButton) {
                                 // If a remote validator returns true and the form is ready to submit, then do it
                                 that._submit();
                             } else if (!response.valid && !verbose) {