summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
diff options
context:
space:
mode:
authorwei <>2006-10-06 03:46:05 +0000
committerwei <>2006-10-06 03:46:05 +0000
commitfe60cc221f922ea362826e2d00431c5df28fe85f (patch)
tree9c0449718a862a5b51d62c4ac9697db15c13863f /framework/Web/UI/ActiveControls/TActiveCustomValidator.php
parent9fee2935d91e92235b068632d3608c748ef41bfe (diff)
fixed #410 #412
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActiveCustomValidator.php')
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
index 686149eb..0a6b7b84 100644
--- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
+++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
@@ -10,6 +10,8 @@
* @package System.Web.UI.ActiveControls
*/
+Prado::using('System.Web.UI.ActiveControls.TCallbackClientSide');
+
/**
* TActiveCustomValidator Class
*
@@ -55,6 +57,7 @@ class TActiveCustomValidator extends TCustomValidator
{
parent::__construct();
$this->setAdapter(new TActiveControlAdapter($this));
+ $this->getActiveControl()->setClientSide(new TActiveCustomValidatorClientSide);
}
/**
@@ -66,6 +69,14 @@ class TActiveCustomValidator extends TCustomValidator
}
/**
+ * @return TCallbackClientSide client side request options.
+ */
+ public function getClientSide()
+ {
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
+ }
+
+ /**
* Client validation function is NOT supported.
*/
public function setClientValidationFunction($value)
@@ -131,4 +142,67 @@ class TActiveCustomValidator extends TCustomValidator
}
}
+/**
+ * Custom Validator callback client side options class.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ * @since 3.1
+ */
+class TActiveCustomValidatorClientSide extends TCallbackClientSide
+{
+ /**
+ * @return string javascript code for client-side OnValidate event.
+ */
+ public function getOnValidate()
+ {
+ return $this->getOption('OnValidate');
+ }
+
+ /**
+ * Client-side OnValidate validator event is raise before the validators
+ * validation functions are called.
+ * @param string javascript code for client-side OnValidate event.
+ */
+ public function setOnValidate($javascript)
+ {
+ $this->setFunction('OnValidate', $javascript);
+ }
+
+ /**
+ * 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)
+ {
+ $this->setFunction('OnError', $javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnError event.
+ */
+ public function getOnError()
+ {
+ return $this->getOption('OnError');
+ }
+
+ /**
+ * @param boolean true to revalidate when the control to validate changes value.
+ */
+ public function setObserveChanges($value)
+ {
+ $this->setOption('ObserveChanges', TPropertyValue::ensureBoolean($value));
+ }
+
+ /**
+ * @return boolean true to observe changes.
+ */
+ public function getObserveChanges()
+ {
+ $changes = $this->getOption('ObserveChanges');
+ return is_null($changes) ? true : $changes;
+ }
+}
?> \ No newline at end of file