From e9aca44c50ee057268c8fa45d69e7e280c11d545 Mon Sep 17 00:00:00 2001 From: jlukic Date: Sun, 28 Feb 2016 19:17:21 -0500 Subject: [PATCH] Fixes #3606, field revalidation would cause whole form to be revalidated --- RELEASE-NOTES.md | 2 ++ src/definitions/behaviors/form.js | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 5cd262542..8b7d880d3 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -14,7 +14,9 @@ - **API** - Fixed bug causing `cache: 'local'` not to return the localstorage cached results in some cases - **API** - Fixes bug where `beforeSend` would not correctly cancel request when `return false;` is used in callback. #3660 - **Dropdown** - Fixed bug where `search selection` would not let you move back in an entered search string with left arrow #3596 **Thanks @Sanjo** +-**Form Validation** - Fixed issue where revalidating a field `on:blur` could cause fields not yet interacted with to be validated #3606 -**Form Validation / Dropdown** - Fixed issue where using "enter" key in a `search dropdown` could cause a form to be submitted #3676 +-**Search** - Fixed issue where a previous unfinished XHR query aborting would cause the next query to fail #2779 -**Divider** - Fixed issue where descenders like "g" would be cut off in `horizontal divider` #3585 **Bugs** diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 0a2e30066..d0ad1d306 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -299,7 +299,9 @@ $.fn.form = function(parameters) { ; if( $fieldGroup.hasClass(className.error) ) { module.debug('Revalidating field', $field, validationRules); - module.validate.form.call(module, event, true); + if(validationRules) { + module.validate.field( validationRules ); + } } else if(settings.on == 'blur' || settings.on == 'change') { if(validationRules) { @@ -310,13 +312,14 @@ $.fn.form = function(parameters) { change: function(event) { var $field = $(this), - $fieldGroup = $field.closest($group) + $fieldGroup = $field.closest($group), + validationRules = module.get.validation($field) ; if(settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) ) { clearTimeout(module.timer); module.timer = setTimeout(function() { module.debug('Revalidating field', $field, module.get.validation($field)); - module.validate.form.call(module, event, true); + module.validate.field( validationRules ); }, settings.delay); } }