summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorxue <>2006-01-09 01:56:12 +0000
committerxue <>2006-01-09 01:56:12 +0000
commit47be9e10cfa0aae464a8e9789db9b438378a6099 (patch)
treebaa5f153dccecb784455fe633d7e53115478d9e7 /framework/Web/UI/WebControls
parenta02e83d8971568617a1723a2bd2b60b79c78faa8 (diff)
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php19
-rw-r--r--framework/Web/UI/WebControls/TButton.php2
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);
}