summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/compressed
diff options
context:
space:
mode:
authorwei <>2006-09-02 00:29:04 +0000
committerwei <>2006-09-02 00:29:04 +0000
commit815c7462bbc4848939aa53cf375a0269d51b81fa (patch)
tree6fa4977ce42f8e28fa71fe32c1e9d07d43d01797 /framework/Web/Javascripts/js/compressed
parent215c1294d356e35b7717b05892a45b9f0b76a847 (diff)
update validators
Diffstat (limited to 'framework/Web/Javascripts/js/compressed')
-rw-r--r--framework/Web/Javascripts/js/compressed/validator.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js
index d3d8c53e..c173014c 100644
--- a/framework/Web/Javascripts/js/compressed/validator.js
+++ b/framework/Web/Javascripts/js/compressed/validator.js
@@ -82,13 +82,14 @@ this.messages.show();this.visible=true;},formats:function(type)
{case"List":output+=messages[i]+"\n";break;case"BulletList":default:output+=" - "+messages[i]+"\n";break;case"SingleParagraph":output+=messages[i]+" ";break;}}
return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={enabled:true,visible:false,isValid:true,options:{},_isObserving:{},group:null,manager:null,message:null,initialize:function(options)
{this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);},getErrorMessage:function()
-{return this.options.ErrorMessage;},updateControl:function()
-{if(this.message)
+{return this.options.ErrorMessage;},updateControl:function(focus)
+{this.refreshControlAndMessage();if(this.options.FocusOnError&&!this.isValid)
+Prado.Element.focus(this.options.FocusElementID);},refreshControlAndMessage:function()
+{this.visible=true;if(this.message)
{if(this.options.Display=="Dynamic")
this.isValid?this.message.hide():this.message.show();this.message.style.visibility=this.isValid?"hidden":"visible";}
if(this.control)
-this.updateControlCssClass(this.control,this.isValid);if(this.options.FocusOnError&&!this.isValid)
-Prado.Element.focus(this.options.FocusElementID);this.visible=true;},updateControlCssClass:function(control,valid)
+this.updateControlCssClass(this.control,this.isValid);},updateControlCssClass:function(control,valid)
{var CssClass=this.options.ControlCssClass;if(typeof(CssClass)=="string"&&CssClass.length>0)
{if(valid)
control.removeClassName(CssClass);else
@@ -99,12 +100,12 @@ this.options.OnValidate(this,invoker);if(this.enabled)
this.isValid=this.evaluateIsValid();else
this.isValid=true;if(this.isValid)
{if(typeof(this.options.OnSuccess)=="function")
-{this.visible=true;this.message.style.visibility="visible";this.updateControlCssClass(this.control,this.isValid);this.options.OnSuccess(this,invoker);}
+{this.refreshControlAndMessage();this.options.OnSuccess(this,invoker);}
else
this.updateControl();}
else
{if(typeof(this.options.OnError)=="function")
-{this.visible=true;this.message.style.visibility="visible";this.updateControlCssClass(this.control,this.isValid);this.options.OnError(this,invoker);}
+{this.refreshControlAndMessage();this.options.OnError(this,invoker);}
else
this.updateControl();}
this.observeChanges(this.control);return this.isValid;},observeChanges:function(control)