@@ -3,6 +3,7 @@
## v0.2.2
* Fixed #34: Avoid from calling form submit recursively
+* Improved #15: Focus to the first invalid element
* Improved #31: remote validator: Allow to set additional data to remote URL
##v0.2.1 (2013-11-08)
@@ -64,7 +64,7 @@
// validator is the BootstrapValidator instance
// form is the jQuery object present the current form
form.find('.alert').html('Thanks for signing up. Now you can sign in as ' + validator.getFieldElement('username').val()).show();
- form.submit();
+ //form.submit();
},
fields: {
username: {
@@ -93,6 +93,12 @@
that._setLiveValidating();
}
+ // Focus to the first invalid field
+ for (var i in that.invalidFields) {
+ that.getFieldElement(i).focus();
+ break;
+ }
+
e.preventDefault();
} else {
if (!that.submitHandlerCalled && that.options.submitHandler && 'function' == typeof that.options.submitHandler) {