summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php')
-rw-r--r--framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php82
1 files changed, 82 insertions, 0 deletions
diff --git a/framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php b/framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php
new file mode 100644
index 00000000..90492a78
--- /dev/null
+++ b/framework/Web/UI/WebControls/TClientSideValidationSummaryOptions.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * TValidationSummary class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Web.UI.WebControls
+ */
+
+/**
+ * TClientSideValidationSummaryOptions class.
+ *
+ * Client-side validation summary events such as {@link setOnHideSummary
+ * OnHideSummary} and {@link setOnShowSummary OnShowSummary} can be modified
+ * through the {@link TBaseValidator:: getClientSide ClientSide} property of a
+ * validation summary.
+ *
+ * The <tt>OnHideSummary</tt> event is raise when the validation summary
+ * requests to hide the messages.
+ *
+ * The <tt>OnShowSummary</tt> event is raised when the validation summary
+ * requests to show the messages.
+ *
+ * See the quickstart documentation for further details.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
+class TClientSideValidationSummaryOptions extends TClientSideOptions
+{
+ /**
+ * @return string javascript code for client-side OnHideSummary event.
+ */
+ public function getOnHideSummary()
+ {
+ return $this->getOption('OnHideSummary');
+ }
+
+ /**
+ * Client-side OnHideSummary validation summary event is raise when all the
+ * validators are valid. This will override the default client-side
+ * validation summary behaviour.
+ * @param string javascript code for client-side OnHideSummary event.
+ */
+ public function setOnHideSummary($javascript)
+ {
+ $this->setFunction('OnHideSummary', $javascript);
+ }
+
+ /**
+ * Client-side OnShowSummary event is raise when one or more validators are
+ * not valid. This will override the default client-side validation summary
+ * behaviour.
+ * @param string javascript code for client-side OnShowSummary event.
+ */
+ public function setOnShowSummary($javascript)
+ {
+ $this->setFunction('OnShowSummary', $javascript);
+ }
+
+ /**
+ * @return string javascript code for client-side OnShowSummary event.
+ */
+ public function getOnShowSummary()
+ {
+ return $this->getOption('OnShowSummary');
+ }
+
+ /**
+ * Ensure the string is a valid javascript function. The code block
+ * is enclosed with "function(summary, validators){ }" block.
+ * @param string javascript code.
+ * @return string javascript function code.
+ */
+ protected function ensureFunction($javascript)
+ {
+ return "function(summary, validators){ {$javascript} }";
+ }
+} \ No newline at end of file