Browse Source

Fixes #3606, field revalidation would cause whole form to be revalidated

pull/3792/head
jlukic 8 years ago
parent
commit
e9aca44c50
2 changed files with 8 additions and 3 deletions
  1. 2
      RELEASE-NOTES.md
  2. 9
      src/definitions/behaviors/form.js

2
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**

9
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);
}
}

Loading…
Cancel
Save