summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorwei <>2006-01-09 04:39:05 +0000
committerwei <>2006-01-09 04:39:05 +0000
commit9f2ecd591d5be41bb9dc7b8a0fa144ac35a173bb (patch)
tree122d77d166d5df687d524173b883d87fd6674c0d /framework/Web/UI
parent9c9a2d731fea9679f65904a3a6b72dd78b4253a4 (diff)
TRequiredFieldValidator works now. See FunctionalTests/index.php in your browser.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php25
-rw-r--r--framework/Web/UI/WebControls/TButton.php12
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');