diff options
author | xue <> | 2006-04-25 01:27:04 +0000 |
---|---|---|
committer | xue <> | 2006-04-25 01:27:04 +0000 |
commit | 1afc913c386bba8e6072c278b0eb4fd9818ab310 (patch) | |
tree | 40cc63eb41f47e0ac392c692619640dca57cd262 /framework/Web/UI/WebControls/TRequiredFieldValidator.php | |
parent | fd019bf034ef4dbedfc305c77fed0dbd83a732c4 (diff) |
Undo previous checkin (which goes int 3.0 branch and will be merged back).
Diffstat (limited to 'framework/Web/UI/WebControls/TRequiredFieldValidator.php')
-rw-r--r-- | framework/Web/UI/WebControls/TRequiredFieldValidator.php | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index 04e333eb..ddbb12c8 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -21,9 +21,6 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); * TRequiredFieldValidator makes the associated input control a required field.
* The input control fails validation if its value does not change from
* the {@link setInitialValue InitialValue} property upon losing focus.
- *
- * Validation will also succeed if input is of TListControl type and the number
- * of selected values different from the initial value is greater than zero.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -56,32 +53,12 @@ class TRequiredFieldValidator extends TBaseValidator * This method overrides the parent's implementation.
* The validation succeeds if the input component changes its data
* from the {@link getInitialValue InitialValue} or the input control is not given.
- *
- * Validation will also succeed if input is of TListControl type and the
- * number of selected values different from the initial value is greater
- * than zero.
- *
* @return boolean whether the validation succeeds
*/
protected function evaluateIsValid()
{
- $control = $this->getValidationTarget();
- $initial = trim($this->getInitialValue());
- if($control instanceof TListControl)
- {
- $count = 0;
- foreach($control->getItems() as $item)
- {
- if($item->getSelected() && $item->getValue() != $initial)
- $count++;
- }
- return $count > 0;
- }
- else
- {
- $value=$this->getValidationValue($control);
- return trim($value)!==$initial || (is_bool($value) && $value);
- }
+ $value=$this->getValidationValue($this->getValidationTarget());
+ return trim($value)!==trim($this->getInitialValue()) || (is_bool($value) && $value);
}
/**
@@ -92,9 +69,6 @@ class TRequiredFieldValidator extends TBaseValidator {
$options = parent::getClientScriptOptions();
$options['InitialValue']=$this->getInitialValue();
- $control = $this->getValidationTarget();
- if($control instanceof TListControl)
- $options['TotalItems'] = $control->getItemCount();
return $options;
}
}
|