Browse Source

#202: The field need to be focused after activating the tab

nghuuphuoc 11 years ago
parent
commit
644aea9b6d

+ 1 - 1
bootstrapValidator.jquery.json

@@ -1,6 +1,6 @@
 {
     "name": "bootstrapValidator",
-    "version": "0.4.3",
+    "version": "0.4.3-dev",
     "title": "BootstrapValidator",
     "author": {
         "name": "Nguyen Huu Phuoc",

+ 1 - 1
bower.json

@@ -1,7 +1,7 @@
 {
     "name": "bootstrapValidator",
     "description": "The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3",
-    "version": "0.4.3",
+    "version": "0.4.3-dev",
     "main": [
         "dist/css/bootstrapValidator.css",
         "dist/js/bootstrapValidator.js"

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -3,7 +3,7 @@
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *
- * @version     v0.4.3
+ * @version     v0.4.3-dev
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 3 - 3
dist/js/bootstrapValidator.js

@@ -3,7 +3,7 @@
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *
- * @version     v0.4.3
+ * @version     v0.4.3-dev
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -345,14 +345,14 @@
 
                 // Focus to the first invalid field
                 if (this.$invalidField) {
-                    this.$invalidField.focus();
-
                     // Activate the tab containing the invalid field if exists
                     var $tab = this.$invalidField.parents('.tab-pane'),
                         tabId;
                     if ($tab && (tabId = $tab.attr('id'))) {
                         $('a[href="#' + tabId + '"][data-toggle="tab"]').trigger('click.bs.tab.data-api');
                     }
+
+                    this.$invalidField.focus();
                 }
 
                 return;

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "bootstrapValidator",
-    "version": "0.4.3",
+    "version": "0.4.3-dev",
     "description": "The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3",
     "keywords": ["jQuery", "plugin", "validate", "validator", "form", "Bootstrap"],
     "author": {

+ 2 - 2
src/js/bootstrapValidator.js

@@ -344,14 +344,14 @@
 
                 // Focus to the first invalid field
                 if (this.$invalidField) {
-                    this.$invalidField.focus();
-
                     // Activate the tab containing the invalid field if exists
                     var $tab = this.$invalidField.parents('.tab-pane'),
                         tabId;
                     if ($tab && (tabId = $tab.attr('id'))) {
                         $('a[href="#' + tabId + '"][data-toggle="tab"]').trigger('click.bs.tab.data-api');
                     }
+
+                    this.$invalidField.focus();
                 }
 
                 return;