diff options
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/WebControls/TBaseValidator.php | 19 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TButton.php | 2 |
2 files changed, 16 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 6326783a..f8bfc28b 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -111,6 +111,14 @@ abstract class TBaseValidator extends TLabel implements IValidator */ protected function addAttributesToRender($writer) { + $display=$this->getDisplay(); + $visible=$this->getEnabled(true) && !$this->getIsValid(); + if($display==='None' || (!$visible && $display==='Dynamic')) + $writer->addStyleAttribute('display','none'); + else if(!$visible) + $writer->addStyleAttribute('visibility','hidden'); + $writer->addAttribute('id',$this->getClientID()); + parent::addAttributesToRender($writer); } /** @@ -125,7 +133,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $options['FocusOnError'] = $this->getFocusOnError(); $options['FocusElementID'] = $this->getFocusElementID(); $options['ValidationGroup'] = $this->getValidationGroup(); - $options['ControlToValidate'] = $this->getControlToValidate(); + $options['ControlToValidate'] = $this->getValidationTarget()->getClientID(); return $options; } @@ -144,6 +152,7 @@ abstract class TBaseValidator extends TLabel implements IValidator $scripts->registerPradoScript('validator'); $js = "Prado.Validation.AddForm('{$this->Page->Form->ClientID}');"; $scripts->registerEndScript($scriptKey, $js); + $this->renderClientScriptValidator(); } parent::onPreRender($param); } @@ -335,10 +344,10 @@ abstract class TBaseValidator extends TLabel implements IValidator { if($control instanceof IValidatable) { - $value=$control->getValidationValue(); - if($value instanceof TListItem) - return $value->getValue(); - else + $value=$control->getValidationPropertyValue(); + //if($value instanceof TListItem) + // return $value->getValue(); + //else return TPropertyValue::ensureString($value); } else diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 735c3b50..7109bca4 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -83,6 +83,8 @@ class TButton extends TWebControl implements IPostBackEventHandler }
else if($this->getEnabled()) // in this case, parent will not render 'disabled'
$writer->addAttribute('disabled','disabled');
+
+ $writer->addAttribute('id',$this->getClientID());
parent::addAttributesToRender($writer);
}
|