summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/base/validation.js
diff options
context:
space:
mode:
authorwei <>2006-01-13 05:16:37 +0000
committerwei <>2006-01-13 05:16:37 +0000
commit8e16e1f6e9b2b79696d03375e2a60fbae6761a64 (patch)
tree6e0e3f96b2d4e4b62c05f993b2c1c8b17ca4e7a9 /framework/Web/Javascripts/base/validation.js
parent8da0f8dd4a0347f15df6e71ac2b0f4b3c27e8475 (diff)
re-focus onchange
Diffstat (limited to 'framework/Web/Javascripts/base/validation.js')
-rw-r--r--framework/Web/Javascripts/base/validation.js14
1 files changed, 7 insertions, 7 deletions
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;
}
},