From 8e16e1f6e9b2b79696d03375e2a60fbae6761a64 Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 13 Jan 2006 05:16:37 +0000 Subject: re-focus onchange --- framework/Web/Javascripts/base/validation.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'framework/Web/Javascripts/base') diff --git a/framework/Web/Javascripts/base/validation.js b/framework/Web/Javascripts/base/validation.js index 78694ca4..33d5411d 100644 --- a/framework/Web/Javascripts/base/validation.js +++ b/framework/Web/Javascripts/base/validation.js @@ -349,13 +349,9 @@ Prado.Validation.prototype = validate : function() { if(this.visible && this.enabled && this.evaluateIsValid) - { this.isValid = this.evaluateIsValid(); - } else - { this.isValid = true; - } this.observe(); //watch for changes to the control values this.update(); //update the validation messages @@ -379,7 +375,11 @@ Prado.Validation.prototype = Element.condClassName(this.control, className, !this.isValid); Prado.Validation.ShowSummary(); - if(this.attr.focusonerror) + var focus = this.attr.focusonerror; + var hasGroup = Prado.Validation.HasTargetGroup; + var inGroup = this.group == Prado.Validation.CurrentTargetGroup; + + if(focus && (!hasGroup || (hasGroup && inGroup))) Prado.Element.focus(this.attr.focuselementid); }, @@ -394,14 +394,14 @@ Prado.Validation.prototype = }, /** - * Observe changes to the control values, add "onblur" event to the control once. + * Observe changes to the control values, add "onchange" event to the control once. */ observe : function() { if(undef(this.observing)) { if(this.control && this.control.form) - Event.observe(this.control, "blur", this.validate.bind(this)); + Event.observe(this.control, "change", this.validate.bind(this)); this.observing = true; } }, -- cgit v1.2.3