summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TRequiredFieldValidator.php
blob: b30de6075137d3a9023c115edaeddda18fc104a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

class TRequiredFieldValidator extends TBaseValidator
{
	public function getInitialValue()
	{
		$this->getViewState('InitialValue','');
	}

	public function setInitialValue($value)
	{
		$this->setViewState('InitialValue',TPropertyValue::ensureString($value),'');
	}

	protected function evaluateIsValid()
	{
		$value=$this->getValidationValue($this->getValidationTarget());
		return trim($value)!==trim($this->getInitialValue());
	}

	protected function getClientScriptOptions()
	{
		$options = parent::getClientScriptOptions();
		$options['initialvalue']=$this->getInitialValue();
		return $options;
	}
}

?>