summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TBaseValidator.php
diff options
context:
space:
mode:
authorxue <>2006-04-21 12:36:06 +0000
committerxue <>2006-04-21 12:36:06 +0000
commite392ecbf6e422825083bc7204eacb7090619a47c (patch)
tree8f2dcc8302f223ac2c71efd762417eddf84d62aa /framework/Web/UI/WebControls/TBaseValidator.php
parentc54a230a5926086ff1b69a0dd7e6352dbc0b40ff (diff)
Merge from 3.0 branch till 953.
Diffstat (limited to 'framework/Web/UI/WebControls/TBaseValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index 03362110..c5b5e7a5 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -131,14 +131,18 @@ 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['controlcssclass'] = $this->getControlCssClass();
+ $options['ID'] = $this->getClientID();
+ $options['FormID'] = $this->getPage()->getForm()->getClientID();
+ $options['Display'] = $this->getDisplay();
+ $options['ErrorMessage'] = $this->getErrorMessage();
+ if($this->getFocusOnError())
+ {
+ $options['FocusOnError'] = $this->getFocusOnError();
+ $options['FocusElementID'] = $this->getFocusElementID();
+ }
+ $options['ValidationGroup'] = $this->getValidationGroup();
+ $options['ControlToValidate'] = $this->getValidationTarget()->getClientID();
+ $options['ControlCssClass'] = $this->getControlCssClass();
return $options;
}
@@ -156,8 +160,10 @@ abstract class TBaseValidator extends TLabel implements IValidator
$scriptKey = "TBaseValidator:$formID";
if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey))
{
+ $manager['FormID'] = $formID;
+ $options = TJavaScript::encode($manager);
$scripts->registerPradoScript('validator');
- $scripts->registerEndScript($scriptKey, "Prado.Validation.AddForm('$formID');");
+ $scripts->registerEndScript($scriptKey, "new Prado.Validation({$options});");
}
if($this->getEnableClientScript())
$this->registerClientScriptValidator();
@@ -195,7 +201,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$scriptKey = "prado:".$this->getClientID();
$scripts = $this->getPage()->getClientScript();
$options = TJavaScript::encode($this->getClientScriptOptions());
- $js = "new Prado.Validation(Prado.Validation.{$class}, {$options});";
+ $js = "new Prado.WebUI.{$class}({$options});";
$scripts->registerEndScript($scriptKey, $js);
}
}