summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/js/compressed/validator.js12
-rw-r--r--framework/Web/Javascripts/js/debug/validator.js14
-rw-r--r--framework/Web/Javascripts/prado/validation3.js14
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php26
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php55
5 files changed, 87 insertions, 34 deletions
diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js
index cca77a81..4134ecc3 100644
--- a/framework/Web/Javascripts/js/compressed/validator.js
+++ b/framework/Web/Javascripts/js/compressed/validator.js
@@ -105,15 +105,15 @@ 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")
+{if(typeof(this.options.OnValidationSuccess)=="function")
{if(this.requestDispatched==false)
-{this.refreshControlAndMessage();this.options.OnSuccess(this,invoker);}}
+{this.refreshControlAndMessage();this.options.OnValidationSuccess(this,invoker);}}
else
this.updateControl();}
else
-{if(typeof(this.options.OnError)=="function")
+{if(typeof(this.options.OnValidationError)=="function")
{if(this.requestDispatched==false)
-{this.refreshControlAndMessage();this.options.OnError(this,invoker)}}
+{this.refreshControlAndMessage();this.options.OnValidationError(this,invoker)}}
else
this.updateControl();}
this.observeChanges(this.control);return this.isValid;},observeChanges:function(control)
@@ -189,8 +189,8 @@ return true;}});Prado.WebUI.TActiveCustomValidator=Class.extend(Prado.WebUI.TBas
{value=this.getValidationValue();if(!this.requestDispatched&&value!=this.validatingValue)
{this.validatingValue=value;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(value);request.setCausesValidation(false);request.options.onSuccess=this.callbackOnSuccess.bind(this);request.options.onFailure=this.callbackOnFailure.bind(this);request.dispatch();this.requestDispatched=true;return false;}
return this.isValid;},callbackOnSuccess:function(request,data)
-{this.isValid=data;this.requestDispatched=false;Prado.Validation.validate(this.options.FormID,this.group,null);if(typeof(this.options.onSuccess)=="function")
-this.options.onSuccess(request,data);},callbackOnFailure:function(request,data)
+{this.isValid=data;this.requestDispatched=false;if(typeof(this.options.onSuccess)=="function")
+this.options.onSuccess(request,data);Prado.Validation.validate(this.options.FormID,this.group,null);},callbackOnFailure:function(request,data)
{this.requestDispatched=false;if(typeof(this.options.onFailure)=="function")
this.options.onFailure(request,data);}});Prado.WebUI.TRangeValidator=Class.extend(Prado.WebUI.TBaseValidator,{evaluateIsValid:function()
{var value=this.getValidationValue();if(value.length<=0)
diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js
index af429e68..8f244667 100644
--- a/framework/Web/Javascripts/js/debug/validator.js
+++ b/framework/Web/Javascripts/js/debug/validator.js
@@ -571,8 +571,8 @@ Prado.WebUI.TBaseValidator.prototype =
* options['ValidationGroup'] Validation group
* options['ControlCssClass'] Css class to use on the input upon error
* options['OnValidate'] Function to call immediately after validation
- * options['OnSuccess'] Function to call upon after successful validation
- * options['OnError'] Function to call upon after error in validation.
+ * options['OnValidationSuccess'] Function to call upon after successful validation
+ * options['OnValidationError'] Function to call upon after error in validation.
* options['ObserveChanges'] True to observe changes in input
* </code>
*/
@@ -685,12 +685,12 @@ Prado.WebUI.TBaseValidator.prototype =
if(this.isValid)
{
- if(typeof(this.options.OnSuccess) == "function")
+ if(typeof(this.options.OnValidationSuccess) == "function")
{
if(this.requestDispatched == false)
{
this.refreshControlAndMessage();
- this.options.OnSuccess(this, invoker);
+ this.options.OnValidationSuccess(this, invoker);
}
}
else
@@ -698,12 +698,12 @@ Prado.WebUI.TBaseValidator.prototype =
}
else
{
- if(typeof(this.options.OnError) == "function")
+ if(typeof(this.options.OnValidationError) == "function")
{
if(this.requestDispatched == false)
{
this.refreshControlAndMessage();
- this.options.OnError(this, invoker)
+ this.options.OnValidationError(this, invoker)
}
}
else
@@ -1143,9 +1143,9 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
this.isValid = data;
this.requestDispatched = false;
- Prado.Validation.validate(this.options.FormID, this.group,null);
if(typeof(this.options.onSuccess) == "function")
this.options.onSuccess(request,data);
+ Prado.Validation.validate(this.options.FormID, this.group,null);
},
callbackOnFailure : function(request, data)
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js
index 8904921f..55ebc095 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validation3.js
@@ -571,8 +571,8 @@ Prado.WebUI.TBaseValidator.prototype =
* options['ValidationGroup'] Validation group
* options['ControlCssClass'] Css class to use on the input upon error
* options['OnValidate'] Function to call immediately after validation
- * options['OnSuccess'] Function to call upon after successful validation
- * options['OnError'] Function to call upon after error in validation.
+ * options['OnValidationSuccess'] Function to call upon after successful validation
+ * options['OnValidationError'] Function to call upon after error in validation.
* options['ObserveChanges'] True to observe changes in input
* </code>
*/
@@ -685,12 +685,12 @@ Prado.WebUI.TBaseValidator.prototype =
if(this.isValid)
{
- if(typeof(this.options.OnSuccess) == "function")
+ if(typeof(this.options.OnValidationSuccess) == "function")
{
if(this.requestDispatched == false)
{
this.refreshControlAndMessage();
- this.options.OnSuccess(this, invoker);
+ this.options.OnValidationSuccess(this, invoker);
}
}
else
@@ -698,12 +698,12 @@ Prado.WebUI.TBaseValidator.prototype =
}
else
{
- if(typeof(this.options.OnError) == "function")
+ if(typeof(this.options.OnValidationError) == "function")
{
if(this.requestDispatched == false)
{
this.refreshControlAndMessage();
- this.options.OnError(this, invoker)
+ this.options.OnValidationError(this, invoker)
}
}
else
@@ -1143,9 +1143,9 @@ Prado.WebUI.TActiveCustomValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
this.isValid = data;
this.requestDispatched = false;
- Prado.Validation.validate(this.options.FormID, this.group,null);
if(typeof(this.options.onSuccess) == "function")
this.options.onSuccess(request,data);
+ Prado.Validation.validate(this.options.FormID, this.group,null);
},
callbackOnFailure : function(request, data)
diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
index 0a6b7b84..a0ef895c 100644
--- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
+++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
@@ -171,21 +171,39 @@ class TActiveCustomValidatorClientSide extends TCallbackClientSide
}
/**
+ * Client-side OnSuccess event is raise after validation is successfull.
+ * This will override the default client-side validator behaviour.
+ * @param string javascript code for client-side OnSuccess event.
+ */
+ public function setOnValidationSuccess($javascript)
+ {
+ $this->setFunction('OnValidationSuccess', $javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnSuccess event.
+ */
+ public function getOnValidationSuccess()
+ {
+ return $this->getOption('OnValidationSuccess');
+ }
+
+ /**
* Client-side OnError event is raised after validation failure.
* This will override the default client-side validator behaviour.
* @param string javascript code for client-side OnError event.
*/
- public function setOnError($javascript)
+ public function setOnValidationError($javascript)
{
- $this->setFunction('OnError', $javascript);
+ $this->setFunction('OnValidationError', $javascript);
}
/**
* @return string javascript code for client-side OnError event.
*/
- public function getOnError()
+ public function getOnValidationError()
{
- return $this->getOption('OnError');
+ return $this->getOption('OnValidationError');
}
/**
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index ad901e17..59af7e7f 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -490,12 +490,12 @@ abstract class TBaseValidator extends TLabel implements IValidator
if($this->evaluateIsValid())
{
$this->setIsValid(true);
- $this->onSuccess();
+ $this->onValidationSuccess();
}
else
{
$this->setIsValid(false);
- $this->onError();
+ $this->onValidationError();
}
}
return $this->getIsValid();
@@ -527,17 +527,17 @@ abstract class TBaseValidator extends TLabel implements IValidator
/**
* This event is raised when the validator succeeds in validation.
*/
- public function onSuccess()
+ public function onValidationSuccess()
{
- $this->raiseEvent('OnSuccess',$this,null);
+ $this->raiseEvent('OnValidationSuccess',$this,null);
}
/**
* This event is raised when the validator fails in validation.
*/
- public function onError()
+ public function onValidationError()
{
- $this->raiseEvent('OnError',$this,null);
+ $this->raiseEvent('OnValidationError',$this,null);
}
/**
@@ -616,7 +616,7 @@ class TValidatorClientSide extends TClientSideOptions
*/
public function setOnSuccess($javascript)
{
- $this->setFunction('OnSuccess', $javascript);
+ $this->setFunction('OnValidationSuccess', $javascript);
}
/**
@@ -624,7 +624,7 @@ class TValidatorClientSide extends TClientSideOptions
*/
public function getOnSuccess()
{
- return $this->getOption('OnSuccess');
+ return $this->getOption('OnValidationSuccess');
}
/**
@@ -634,7 +634,7 @@ class TValidatorClientSide extends TClientSideOptions
*/
public function setOnError($javascript)
{
- $this->setFunction('OnError', $javascript);
+ $this->setFunction('OnValidationError', $javascript);
}
/**
@@ -642,7 +642,42 @@ class TValidatorClientSide extends TClientSideOptions
*/
public function getOnError()
{
- return $this->getOption('OnError');
+ return $this->getOption('OnValidationError');
+ }
+
+
+ /**
+ * Alias for OnSuccess
+ * @param string javascript code for client-side OnSuccess event.
+ */
+ public function setOnValidationSuccess($javascript)
+ {
+ $this->setOnSuccess($javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnSuccess event.
+ */
+ public function getOnValidationSuccess()
+ {
+ return $this->getOnSuccess();
+ }
+
+ /**
+ * Alias for OnError
+ * @param string javascript code for client-side OnError event.
+ */
+ public function setOnValidationError($javascript)
+ {
+ $this->setOnError($javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnError event.
+ */
+ public function getOnValidationError()
+ {
+ return $this->getOnError();
}
/**