diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 13 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 6 |
2 files changed, 12 insertions, 7 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; } /** diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index e03bc676..0b4f3e37 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -75,13 +75,15 @@ class TButton extends TWebControl implements IPostBackEventHandler $writer->addAttribute('name',$uniqueID);
$writer->addAttribute('value',$this->getText());
if($this->getEnabled(true))
- {
+ {
$scripts = $this->getPage()->getClientScript();
if($scripts->isEndScriptRegistered("TBaseValidator"))
{
$group = $this->getValidationGroup();
$group = strlen($group) ? ",'".$group."'" : '';
- $script = "Prado.Validation.AddTarget('{$uniqueID}'{$group});";
+ $clientID=$this->getClientID();
+ //$script = "Prado.Validation.AddTarget('{$uniqueID}'{$group});";
+ $script = "Prado.Validation.AddTarget('{$clientID}'{$group});";
$scripts->registerEndScript("{$uniqueID}:target", $script);
}
}
|