diff options
author | xue <> | 2006-06-10 14:58:25 +0000 |
---|---|---|
committer | xue <> | 2006-06-10 14:58:25 +0000 |
commit | 233ad780df391ed4af569929c30a1370d2b440ef (patch) | |
tree | 4438c64202dfc25dd7be0992d18c442a03631e12 | |
parent | c6b4190fab88201f4efaa0d00a6aa823b180f482 (diff) |
Merge from 3.0 branch till 1150.
Fixed the bug that postback js causes controls not inheritable.
25 files changed, 192 insertions, 60 deletions
@@ -1,5 +1,6 @@ Version 3.1.0 To be released
============================
+BUG: Ticket#188 - Postback js caused controls not inheritable (Qiang)
ENH: Ticket#99 - TXmlTransform control (Knut)
ENH: Ticket#117 - added support to configure subproperties in a group. (Qiang)
NEW: TOutputCache (Qiang)
@@ -9,6 +10,7 @@ NEW: SQLMap (Wei) Version 3.0.2 July 2, 2006
==========================
+BUG: Ticket#182 - List and validator controls cause problem in child classes (Qiang)
BUG: Ticket#213 - PRADO Requirements Checker charset error (Qiang)
CHG: ensureChildControls() is now invoked in TControl::initRecursive (Qiang)
diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index c57534b1..8c79d6ee 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -235,7 +235,7 @@ basevalidator_forcontrol_unsupported = {0}.ForControl is not supported. comparevalidator_controltocompare_invalid = TCompareValidator.ControlToCompare contains an invalid control ID path.
-tlistcontrolvalidator_invalid_control = {0}.ControlToValidate contains an invalid TListControl ID path, "{1}" is a {2}.
+listcontrolvalidator_invalid_control = {0}.ControlToValidate contains an invalid TListControl ID path, "{1}" is a {2}.
repeater_template_required = TRepeater.{0} requires a template instance implementing ITemplate interface.
datalist_template_required = TDataList.{0} requires a template instance implementing ITemplate interface.
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 3926d166..cab4d288 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -166,7 +166,7 @@ class TClientScriptManager extends TApplicationComponent public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null) { - $options = !is_array($options) ? array() : $options; + $options = !is_array($options) ? array() : $options; $class = new TReflectionClass($callbackHandler); $clientSide = $callbackHandler->getActiveControl()->getClientSide(); $options = array_merge($options, $clientSide->getOptions()->toArray()); @@ -203,7 +203,7 @@ class TClientScriptManager extends TApplicationComponent if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null) $options['FormID']=$form->getClientID(); $optionString=TJavaScript::encode($options); - $code="new Prado.WebUI.{$class}({$optionString});"; + $code="new {$class}({$optionString});"; $this->_endScripts[sprintf('%08X', crc32($code))]=$code; $this->_hiddenFields[TPage::FIELD_POSTBACK_TARGET]=''; @@ -564,7 +564,7 @@ abstract class TClientSideOptions extends TComponent * @var TMap list of client-side options. */ private $_options; - + /** * Constructor, initialize the options list. */ @@ -572,7 +572,7 @@ abstract class TClientSideOptions extends TComponent { $this->_options = Prado::createComponent('System.Collections.TMap'); } - + /** * Adds on client-side event handler by wrapping the code within a * javascript function block. If the code begins with "javascript:", the @@ -584,10 +584,10 @@ abstract class TClientSideOptions extends TComponent protected function setFunction($name, $code) { if(!TJavascript::isFunction($code)) - $code = TJavascript::quoteFunction($this->ensureFunction($code)); + $code = TJavascript::quoteFunction($this->ensureFunction($code)); $this->setOption($name, $code); } - + /** * @return string gets a particular option, null if not set. */ @@ -595,7 +595,7 @@ abstract class TClientSideOptions extends TComponent { return $this->_options->itemAt($name); } - + /** * @param string option name * @param mixed option value. @@ -604,7 +604,7 @@ abstract class TClientSideOptions extends TComponent { $this->_options->add($name, $value); } - + /** * @return TMap gets the list of options as TMap */ @@ -612,7 +612,7 @@ abstract class TClientSideOptions extends TComponent { return $this->_options; } - + /** * Ensure that the javascript statements are wrapped in a javascript * function block. Default has no wrapping. Override this method to diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 3c76db30..3fe9ee03 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -264,16 +264,21 @@ abstract class TBaseValidator extends TLabel implements IValidator { if($this->getEnabled(true)) { - $class = get_class($this); - $scriptKey = "prado:".$this->getClientID(); - $scripts = $this->getPage()->getClientScript(); - $options = TJavaScript::encode($this->getClientScriptOptions()); - $js = "new Prado.WebUI.{$class}({$options});"; - $scripts->registerEndScript($scriptKey, $js); + $key = 'prado:'.$this->getClientID(); + $options = TJavaScript::encode($this->getClientScriptOptions()); + $script = 'new '.$this->getClientClassName().'('.$options.');'; + $this->getPage()->getClientScript()->registerEndScript($key, $script); } } /** + * Gets the name of the javascript class responsible for performing validation for this control. + * This method overrides the parent implementation. + * @return string the javascript class name + */ + abstract protected function getClientClassName(); + + /** * This method overrides the parent implementation to forbid setting ForControl. * @param string the associated control ID * @throws TNotSupportedException whenever this method is called diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php index fad77232..dfed0b6e 100644 --- a/framework/Web/UI/WebControls/TBulletedList.php +++ b/framework/Web/UI/WebControls/TBulletedList.php @@ -84,6 +84,16 @@ class TBulletedList extends TListControl implements IPostBackEventHandler }
/**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TBulletedList';
+ }
+
+ /**
* Adds attribute name-value pairs to renderer.
* This overrides the parent implementation with additional bulleted list specific attributes.
* @param THtmlWriter the writer used for the rendering purpose
@@ -323,7 +333,8 @@ class TBulletedList extends TListControl implements IPostBackEventHandler $this->_currentRenderItemIndex = $index;
$writer->addAttribute('id', $this->getClientID().$index);
$writer->addAttribute('href', "javascript:;//".$this->getClientID().$index);
- $this->renderClientControlScript($writer);
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TBulletedList',$this->getPostBackOptions());
}
if(($accesskey=$this->getAccessKey())!=='')
$writer->addAttribute('accesskey',$accesskey);
@@ -331,15 +342,6 @@ class TBulletedList extends TListControl implements IPostBackEventHandler $writer->write(THttpUtility::htmlEncode($item->getText()));
$writer->renderEndTag();
}
-
- /**
- * Renders the client-script code.
- */
- protected function renderClientControlScript($writer)
- {
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
- }
/**
* @return array postback options used for linkbuttons.
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php index 75d60695..f1302853 100644 --- a/framework/Web/UI/WebControls/TButton.php +++ b/framework/Web/UI/WebControls/TButton.php @@ -87,9 +87,9 @@ class TButton extends TWebControl implements IPostBackEventHandler, IButtonContr {
if($this->canCauseValidation())
{
- $writer->addAttribute('id',$this->getClientID());
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
+ $writer->addAttribute('id',$this->getClientID());
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TButton',$this->getPostBackOptions());
}
}
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php index fda0480d..37ea0369 100644 --- a/framework/Web/UI/WebControls/TCheckBox.php +++ b/framework/Web/UI/WebControls/TCheckBox.php @@ -375,8 +375,8 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl */
protected function renderClientControlScript($writer)
{
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TCheckBox',$this->getPostBackOptions());
}
/**
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php index 2a16673c..e6ca3642 100644 --- a/framework/Web/UI/WebControls/TCheckBoxList.php +++ b/framework/Web/UI/WebControls/TCheckBoxList.php @@ -106,6 +106,16 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont }
/**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TCheckBoxList';
+ }
+
+ /**
* @return string the alignment of the text caption, defaults to 'Right'.
*/
public function getTextAlign()
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php index b5ebd3ab..93664b2e 100644 --- a/framework/Web/UI/WebControls/TCompareValidator.php +++ b/framework/Web/UI/WebControls/TCompareValidator.php @@ -31,8 +31,8 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); * type before the comparison operation is performed. The following value types are supported:
* - <b>Integer</b> A 32-bit signed integer data type.
* - <b>Float</b> A double-precision floating point number data type.
- * - <b>Date</b> A date data type. The format can be specified by the
- * {@link setDateFormat DateFormat} property
+ * - <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
@@ -47,6 +47,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TCompareValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TCompareValidator';
+ }
+
+ /**
* @return string the data type that the values being compared are converted to before the comparison is made. Defaults to String.
*/
public function getDataType()
diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php index 27cfa67a..32510f89 100644 --- a/framework/Web/UI/WebControls/TCustomValidator.php +++ b/framework/Web/UI/WebControls/TCustomValidator.php @@ -55,6 +55,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TCustomValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TCustomValidator';
+ }
+
+ /**
* @return string the name of the custom client-side script function used for validation.
*/
public function getClientValidationFunction()
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php index ebcaace7..bd7569fc 100644 --- a/framework/Web/UI/WebControls/TDataTypeValidator.php +++ b/framework/Web/UI/WebControls/TDataTypeValidator.php @@ -37,6 +37,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TDataTypeValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TDataTypeValidator';
+ }
+
+ /**
* @return string the data type that the values being compared are converted to before the comparison is made. Defaults to String.
*/
public function getDataType()
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php index 14a4dac4..860fe69c 100644 --- a/framework/Web/UI/WebControls/TDropDownList.php +++ b/framework/Web/UI/WebControls/TDropDownList.php @@ -39,6 +39,16 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid }
/**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TDropDownList';
+ }
+
+ /**
* Loads user input data.
* This method is primarly used by framework developers.
* @param string the key that can be used to retrieve data from the input data collection
diff --git a/framework/Web/UI/WebControls/TEmailAddressValidator.php b/framework/Web/UI/WebControls/TEmailAddressValidator.php index 3534d1d0..e1150233 100644 --- a/framework/Web/UI/WebControls/TEmailAddressValidator.php +++ b/framework/Web/UI/WebControls/TEmailAddressValidator.php @@ -36,6 +36,16 @@ class TEmailAddressValidator extends TRegularExpressionValidator const EMAIL_REGEXP="\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TEmailAddressValidator';
+ }
+
+ /**
* @return string the regular expression that determines the pattern used to validate a field.
*/
public function getRegularExpression()
diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index 4b482721..df8ace43 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -102,8 +102,8 @@ class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEven if($this->canCauseValidation())
{
$writer->addAttribute('id',$this->getClientID());
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TImageButton',$this->getPostBackOptions());
}
}
/**
diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php index ae2d6be3..be7bfea9 100644 --- a/framework/Web/UI/WebControls/TImageMap.php +++ b/framework/Web/UI/WebControls/TImageMap.php @@ -118,14 +118,14 @@ class TImageMap extends TImage implements IPostBackEventHandler $writer->renderEndTag();
}
}
-
+
/**
* Renders the client-script code.
*/
protected function renderClientControlScript($writer,$options)
{
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$options);
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TImageMap',$options);
}
/**
diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php index 7487b37a..e7fea0b5 100644 --- a/framework/Web/UI/WebControls/TLinkButton.php +++ b/framework/Web/UI/WebControls/TLinkButton.php @@ -95,7 +95,7 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler, IButtonC $nop = "javascript:;//".$this->getClientID();
$writer->addAttribute('href', $nop);
$cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
+ $cs->registerPostBackControl('Prado.WebUI.TLinkButton',$this->getPostBackOptions());
}
/**
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php index 5ee3f58e..972ebbcb 100644 --- a/framework/Web/UI/WebControls/TListBox.php +++ b/framework/Web/UI/WebControls/TListBox.php @@ -48,6 +48,16 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl }
/**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TListBox';
+ }
+
+ /**
* Registers the list control to load post data on postback.
* This method overrides the parent implementation.
* @param mixed event parameter
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index f20ff4cc..2c42c462 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -113,22 +113,25 @@ abstract class TListControl extends TDataBoundControl $page->ensureRenderInForm($this);
if($this->getIsMultiSelect())
$writer->addAttribute('multiple','multiple');
- if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript())
- $this->renderClientControlScript($writer);
- if(!$this->getEnabled(true) && $this->getEnabled())
+ if($this->getEnabled(true))
+ {
+ if($this->getAutoPostBack() && $page->getClientSupportsJavaScript())
+ {
+ $writer->addAttribute('id',$this->getClientID());
+ $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
+ }
+ }
+ else if($this->getEnabled())
$writer->addAttribute('disabled','disabled');
parent::addAttributesToRender($writer);
}
/**
- * Renders the client-script code.
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
*/
- protected function renderClientControlScript($writer)
- {
- $writer->addAttribute('id',$this->getClientID());
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
- }
+ abstract protected function getClientClassName();
/**
* @return array postback options for JS postback code
@@ -812,4 +815,4 @@ class TListItemCollection extends TList }
}
-?>
\ No newline at end of file +?>
diff --git a/framework/Web/UI/WebControls/TListControlValidator.php b/framework/Web/UI/WebControls/TListControlValidator.php index be69085d..010a7e77 100644 --- a/framework/Web/UI/WebControls/TListControlValidator.php +++ b/framework/Web/UI/WebControls/TListControlValidator.php @@ -64,6 +64,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TListControlValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TListControlValidator';
+ }
+
+ /**
* @return integer min number of selections. Defaults to -1, meaning not set.
*/
public function getMinSelection()
@@ -195,7 +205,7 @@ class TListControlValidator extends TBaseValidator if(!$control instanceof TListControl)
{
throw new TConfigurationException(
- 'tlistcontrolvalidator_invalid_control',
+ 'listcontrolvalidator_invalid_control',
$this->getID(),$this->getControlToValidate(), get_class($control));
}
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index dc7ba057..688b99bf 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -168,15 +168,15 @@ class TRadioButton extends TCheckBox $writer->renderBeginTag('input');
$writer->renderEndTag();
}
-
+
/**
* Renders the client-script code.
*/
protected function renderClientControlScript($writer)
{
- $cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
- }
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPostBackControl('Prado.WebUI.TRadioButton',$this->getPostBackOptions());
+ }
}
?>
\ No newline at end of file diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php index b0a36c9d..95725836 100644 --- a/framework/Web/UI/WebControls/TRadioButtonList.php +++ b/framework/Web/UI/WebControls/TRadioButtonList.php @@ -53,6 +53,16 @@ class TRadioButtonList extends TCheckBoxList }
/**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TRadioButtonList';
+ }
+
+ /**
* Loads user input data.
* This method is primarly used by framework developers.
* @param string the key that can be used to retrieve data from the input data collection
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php index b7387522..9d23eb5e 100644 --- a/framework/Web/UI/WebControls/TRangeValidator.php +++ b/framework/Web/UI/WebControls/TRangeValidator.php @@ -43,6 +43,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TRangeValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TRangeValidator';
+ }
+
+ /**
* @return string the minimum value of the validation range.
*/
public function getMinValue()
diff --git a/framework/Web/UI/WebControls/TRegularExpressionValidator.php b/framework/Web/UI/WebControls/TRegularExpressionValidator.php index e73fd5be..3099514b 100644 --- a/framework/Web/UI/WebControls/TRegularExpressionValidator.php +++ b/framework/Web/UI/WebControls/TRegularExpressionValidator.php @@ -50,6 +50,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TRegularExpressionValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TRegularExpressionValidator';
+ }
+
+ /**
* @return string the regular expression that determines the pattern used to validate a field.
*/
public function getRegularExpression()
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index 04e333eb..b8a939ad 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -21,7 +21,7 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); * TRequiredFieldValidator makes the associated input control a required field.
* The input control fails validation if its value does not change from
* the {@link setInitialValue InitialValue} property upon losing focus.
- *
+ *
* Validation will also succeed if input is of TListControl type and the number
* of selected values different from the initial value is greater than zero.
*
@@ -33,6 +33,16 @@ Prado::using('System.Web.UI.WebControls.TBaseValidator'); class TRequiredFieldValidator extends TBaseValidator
{
/**
+ * Gets the name of the javascript class responsible for performing validation for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.TRequiredFieldValidator';
+ }
+
+ /**
* @return string the initial value of the associated input control. Defaults to empty string.
* If the associated input control does not change from this initial value
* upon postback, the validation fails.
@@ -56,11 +66,11 @@ class TRequiredFieldValidator extends TBaseValidator * This method overrides the parent's implementation.
* The validation succeeds if the input component changes its data
* from the {@link getInitialValue InitialValue} or the input control is not given.
- *
+ *
* Validation will also succeed if input is of TListControl type and the
* number of selected values different from the initial value is greater
* than zero.
- *
+ *
* @return boolean whether the validation succeeds
*/
protected function evaluateIsValid()
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index b443fa59..73b1e9cc 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -152,9 +152,9 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable */
protected function renderClientControlScript($writer)
{
- $writer->addAttribute('id',$this->getClientID());
+ $writer->addAttribute('id',$this->getClientID());
$cs = $this->getPage()->getClientScript();
- $cs->registerPostBackControl(get_class($this),$this->getPostBackOptions());
+ $cs->registerPostBackControl('Prado.WebUI.TTextBox',$this->getPostBackOptions());
}
/**
|