summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php26
-rw-r--r--framework/Web/UI/WebControls/TButton.php1
-rw-r--r--framework/Web/UI/WebControls/TCompareValidator.php13
-rw-r--r--framework/Web/UI/WebControls/TCustomValidator.php2
-rw-r--r--framework/Web/UI/WebControls/TRangeValidator.php8
-rw-r--r--framework/Web/UI/WebControls/TRegularExpressionValidator.php2
-rw-r--r--framework/Web/UI/WebControls/TRequiredFieldValidator.php2
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php20
8 files changed, 41 insertions, 33 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);
}
}
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php
index 72c68a2c..b9872a64 100644
--- a/framework/Web/UI/WebControls/TButton.php
+++ b/framework/Web/UI/WebControls/TButton.php
@@ -109,6 +109,7 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr
{
$options['ID']=$this->getClientID();
$options['CausesValidation']=$this->getCausesValidation();
+ $options['EventTarget'] = $this->getUniqueID();
$options['ValidationGroup']=$this->getValidationGroup();
return $options;
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php
index 1bf4c529..172e472f 100644
--- a/framework/Web/UI/WebControls/TCompareValidator.php
+++ b/framework/Web/UI/WebControls/TCompareValidator.php
@@ -32,7 +32,8 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator');
* - <b>Integer</b> A 32-bit signed integer data type.
* - <b>Float</b> A double-precision floating point number data type.
* - <b>Currency</b> A decimal data type that can contain currency symbols.
- * - <b>Date</b> A date data type. The format follows the GNU date syntax.
+ * - <b>Date</b> A date data type. The format can be specified by the
+ * {@link setDateFormat DateFormat} property
* - <b>String</b> A string data type.
*
* Use the {@link setOperator Operator} property to specify the type of comparison
@@ -220,15 +221,15 @@ class TCompareValidator extends TBaseValidator
if(($name=$this->getControlToCompare())!=='')
{
if(($control=$this->findControl($name))!==null)
- $options['controltocompare']=$options['controlhookup']=$control->getClientID();
+ $options['ControlToCompare']=$control->getClientID();
}
if(($value=$this->getValueToCompare())!=='')
- $options['valuetocompare']=$value;
+ $options['ValueToCompare']=$value;
if(($operator=$this->getOperator())!=='Equal')
- $options['operator']=$operator;
- $options['type']=$this->getDataType();
+ $options['Operator']=$operator;
+ $options['DataType']=$this->getDataType();
if(($dateFormat=$this->getDateFormat())!=='')
- $options['dateformat']=$dateFormat;
+ $options['DateFormat']=$dateFormat;
return $options;
}
}
diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php
index b72ec344..27cfa67a 100644
--- a/framework/Web/UI/WebControls/TCustomValidator.php
+++ b/framework/Web/UI/WebControls/TCustomValidator.php
@@ -107,7 +107,7 @@ class TCustomValidator extends TBaseValidator
{
$options=parent::getClientScriptOptions();
if(($clientJs=$this->getClientValidationFunction())!=='')
- $options['clientvalidationfunction']=$clientJs;
+ $options['ClientValidationFunction']=$clientJs;
return $options;
}
}
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php
index 7ded3e71..56cc16bc 100644
--- a/framework/Web/UI/WebControls/TRangeValidator.php
+++ b/framework/Web/UI/WebControls/TRangeValidator.php
@@ -271,11 +271,11 @@ class TRangeValidator extends TBaseValidator
protected function getClientScriptOptions()
{
$options=parent::getClientScriptOptions();
- $options['minimumvalue']=$this->getMinValue();
- $options['maximumvalue']=$this->getMaxValue();
- $options['type']=$this->getDataType();
+ $options['MinValue']=$this->getMinValue();
+ $options['MaxValue']=$this->getMaxValue();
+ $options['DataType']=$this->getDataType();
if(($dateFormat=$this->getDateFormat())!=='')
- $options['dateformat']=$dateFormat;
+ $options['DateFormat']=$dateFormat;
return $options;
}
}
diff --git a/framework/Web/UI/WebControls/TRegularExpressionValidator.php b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
index 4271c820..e73fd5be 100644
--- a/framework/Web/UI/WebControls/TRegularExpressionValidator.php
+++ b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
@@ -89,7 +89,7 @@ class TRegularExpressionValidator extends TBaseValidator
protected function getClientScriptOptions()
{
$options = parent::getClientScriptOptions();
- $options['validationexpression']=$this->getRegularExpression();
+ $options['ValidationExpression']=$this->getRegularExpression();
return $options;
}
}
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php
index 702fc5d2..ddbb12c8 100644
--- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php
+++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php
@@ -68,7 +68,7 @@ class TRequiredFieldValidator extends TBaseValidator
protected function getClientScriptOptions()
{
$options = parent::getClientScriptOptions();
- $options['initialvalue']=$this->getInitialValue();
+ $options['InitialValue']=$this->getInitialValue();
return $options;
}
}
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 437e10d6..0d9f88e3 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -219,7 +219,7 @@ class TValidationSummary extends TWebControl
if(!$this->getEnabled(true) || !$this->getEnableClientScript())
return;
$options=TJavaScript::encode($this->getClientScriptOptions());
- $script = "new Prado.Validation.Summary({$options});";
+ $script = "new Prado.WebUI.TValidationSummary({$options});";
$this->getPage()->getClientScript()->registerEndScript($this->getClientID(), $script);
}
@@ -229,19 +229,19 @@ class TValidationSummary extends TWebControl
*/
protected function getClientScriptOptions()
{
- $options['id'] = $this->ClientID;
- $options['form'] = $this->Page->Form->ClientID;
+ $options['ID'] = $this->ClientID;
+ $options['FormID'] = $this->Page->Form->ClientID;
if($this->getShowMessageBox())
- $options['showmessagebox']='True';
+ $options['ShowMessageBox']=true;
if(!$this->getShowSummary())
- $options['showsummary']='False';
+ $options['ShowSummary']=false;
- $options['headertext']=$this->getHeaderText();
- $options['displaymode']=$this->getDisplayMode();
+ $options['HeaderText']=$this->getHeaderText();
+ $options['DisplayMode']=$this->getDisplayMode();
- $options['refresh'] = $this->getAutoUpdate();
- $options['validationgroup'] = $this->getValidationGroup();
- $options['display'] = $this->getDisplay();
+ $options['Refresh'] = $this->getAutoUpdate();
+ $options['ValidationGroup'] = $this->getValidationGroup();
+ $options['Display'] = $this->getDisplay();
return $options;
}