summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBaseValidator.php
diff options
context:
space:
mode:
authorxue <>2006-09-04 19:15:47 +0000
committerxue <>2006-09-04 19:15:47 +0000
commit56fee292c37e162c03fab9eeadd6a8b9ab85c251 (patch)
tree923510b93c707868098ae4e5f404eb3766a59553 /framework/Web/UI/WebControls/TBaseValidator.php
parentb107cad91733d4a2a80f42cdbaab41a4f7b41c9d (diff)
merge from 3.0 branch till 1387
Diffstat (limited to 'framework/Web/UI/WebControls/TBaseValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php58
1 files changed, 52 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index a6d044ff..bc8c3607 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -137,7 +137,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
{
$display=$this->getDisplay();
$visible=$this->getEnabled(true) && !$this->getIsValid();
- if($display==='None' || (!$visible && $display==='Dynamic'))
+ if($display===TValidatorDisplayStyle::None || (!$visible && $display===TValidatorDisplayStyle::Dynamic))
$writer->addStyleAttribute('display','none');
else if(!$visible)
$writer->addStyleAttribute('visibility','hidden');
@@ -311,20 +311,19 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
/**
- * @return string the display behavior (None, Static, Dynamic) of the error message in a validation control. Defaults to Static.
+ * @return TValidatorDisplayStyle the style of displaying the error message. Defaults to TValidatorDisplayStyle::Fixed.
*/
public function getDisplay()
{
- return $this->getViewState('Display','Static');
+ return $this->getViewState('Display',TValidatorDisplayStyle::Fixed);
}
/**
- * Sets the display behavior (None, Static, Dynamic) of the error message in a validation control.
- * @param string the display behavior (None, Static, Dynamic)
+ * @param TValidatorDisplayStyle the style of displaying the error message
*/
public function setDisplay($value)
{
- $this->setViewState('Display',TPropertyValue::ensureEnum($value,array('None','Static','Dynamic')),'Static');
+ $this->setViewState('Display',TPropertyValue::ensureEnum($value,'TValidatorDisplayStyle'),TValidatorDisplayStyle::Fixed);
}
/**
@@ -676,4 +675,51 @@ class TValidatorClientSide extends TClientSideOptions
}
}
+
+/**
+ * TValidatorDisplayStyle class.
+ * TValidatorDisplayStyle defines the enumerable type for the possible styles
+ * that a validator control can display the error message.
+ *
+ * The following enumerable values are defined:
+ * - None: the error message is not displayed
+ * - Dynamic: the error message dynamically appears when the validator fails validation
+ * - Fixed: Similar to Dynamic except that the error message physically occupies the page layout (even though it may not be visible)
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidatorDisplayStyle extends TEnumerable
+{
+ const None='None';
+ const Dynamic='Dynamic';
+ const Fixed='Fixed';
+}
+
+/**
+ * TValidationDataType class.
+ * TValidationDataType defines the enumerable type for the possible data types that
+ * a comparison validator can validate upon.
+ *
+ * The following enumerable values are defined:
+ * - Integer
+ * - Float
+ * - Date
+ * - String
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TValidationDataType extends TEnumerable
+{
+ const Integer='Integer';
+ const Float='Float';
+ const Date='Date';
+ const String='String';
+}
+
?>