diff options
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 25 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 12 |
2 files changed, 22 insertions, 15 deletions
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(); } /** diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 7109bca4..e03bc676 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -75,11 +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();
- $options = $this->getPostBackOptions();
- $postback = $scripts->getPostBackEventReference($this, '', $options, false);
- $scripts->registerClientEvent($this, "click", $postback);
+ if($scripts->isEndScriptRegistered("TBaseValidator"))
+ {
+ $group = $this->getValidationGroup();
+ $group = strlen($group) ? ",'".$group."'" : '';
+ $script = "Prado.Validation.AddTarget('{$uniqueID}'{$group});";
+ $scripts->registerEndScript("{$uniqueID}:target", $script);
+ }
}
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
|