diff options
author | xue <> | 2006-01-09 21:37:12 +0000 |
---|---|---|
committer | xue <> | 2006-01-09 21:37:12 +0000 |
commit | dfde83887227d19b3b413f19e2693fd790d661e1 (patch) | |
tree | 7fa65a6537f7f504b004fe7dae76c3e8a7364cc5 /framework/Web/UI/WebControls/TBaseValidator.php | |
parent | 22b9af8b9858fca190efc8e0e5ff1053d7a86c41 (diff) |
Diffstat (limited to 'framework/Web/UI/WebControls/TBaseValidator.php')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index fb6cca06..d82150ca 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -150,10 +150,12 @@ abstract class TBaseValidator extends TLabel implements IValidator if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) { $scripts->registerPradoScript('validator'); - $js = "Prado.Validation.AddForm('{$this->Page->Form->ClientID}');"; + $formID=$this->getPage()->getForm()->getClientID(); + $js = "Prado.Validation.AddForm('$formID');"; $scripts->registerEndScript($scriptKey, $js); - $this->renderClientScriptValidator(); } + if($this->getEnableClientScript()) + $this->renderClientScriptValidator(); parent::onPreRender($param); } @@ -278,7 +280,7 @@ abstract class TBaseValidator extends TLabel implements IValidator */ public function setFocusOnError($value) { - $this->setViewState('FocusOnError',TPropertyValue::ensureBoolean($value),true); + $this->setViewState('FocusOnError',TPropertyValue::ensureBoolean($value),false); } /** @@ -288,8 +290,9 @@ abstract class TBaseValidator extends TLabel implements IValidator */ public function getFocusElementID() { - // TODO: identify the ControlToValidate - return $this->getViewState('FocusElementID', ''); + if(($id=$this->getViewState('FocusElementID',''))==='') + $id=$this->getValidationTarget()->getClientID(); + return $id; } /** |