From 9f2ecd591d5be41bb9dc7b8a0fa144ac35a173bb Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 9 Jan 2006 04:39:05 +0000 Subject: TRequiredFieldValidator works now. See FunctionalTests/index.php in your browser. --- framework/Web/UI/WebControls/TBaseValidator.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'framework/Web/UI/WebControls/TBaseValidator.php') diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index f8bfc28b..fb6cca06 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -127,13 +127,13 @@ abstract class TBaseValidator extends TLabel implements IValidator */ protected function getClientScriptOptions() { - $options['ID'] = $this->getClientID(); - $options['Display'] = $this->getDisplay(); - $options['ErrorMessage'] = $this->getErrorMessage(); - $options['FocusOnError'] = $this->getFocusOnError(); - $options['FocusElementID'] = $this->getFocusElementID(); - $options['ValidationGroup'] = $this->getValidationGroup(); - $options['ControlToValidate'] = $this->getValidationTarget()->getClientID(); + $options['id'] = $this->getClientID(); + $options['display'] = $this->getDisplay(); + $options['errormessage'] = $this->getErrorMessage(); + $options['focusonerror'] = $this->getFocusOnError(); + $options['focuselementid'] = $this->getFocusElementID(); + $options['validationgroup'] = $this->getValidationGroup(); + $options['controltovalidate'] = $this->getValidationTarget()->getClientID(); return $options; } @@ -146,7 +146,7 @@ abstract class TBaseValidator extends TLabel implements IValidator protected function onPreRender($param) { $scripts = $this->getPage()->getClientScript(); - $scriptKey = "prado:".get_class($this); + $scriptKey = "TBaseValidator"; if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) { $scripts->registerPradoScript('validator'); @@ -234,7 +234,8 @@ abstract class TBaseValidator extends TLabel implements IValidator */ public function getErrorMessage() { - return $this->getViewState('ErrorMessage',''); + return $this->getText(); + //return $this->getViewState('ErrorMessage',''); } /** @@ -243,7 +244,8 @@ abstract class TBaseValidator extends TLabel implements IValidator */ public function setErrorMessage($value) { - $this->setViewState('ErrorMessage',$value,''); + $this->setText($value); + //$this->setViewState('ErrorMessage',$value,''); } /** @@ -364,7 +366,8 @@ abstract class TBaseValidator extends TLabel implements IValidator $this->setIsValid(true); $control=$this->getValidationTarget(); if($control && $this->getVisible(true) && $this->getEnabled()) - $valid=$this->evaluateIsValid(); + $this->setIsValid($this->evaluateIsValid()); + return $this->getIsValid(); } /** -- cgit v1.2.3