From baf2eb12bc99905ad18fadaa4a542a0d109f9245 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 21 Jan 2006 03:57:16 +0000 Subject: TTextBox demo completed. Fixed a few issues related with AutoPostBack=true. --- framework/Web/UI/TPage.php | 12 ++---------- framework/Web/UI/WebControls/TRequiredFieldValidator.php | 2 +- framework/Web/UI/WebControls/TTextBox.php | 9 ++------- 3 files changed, 5 insertions(+), 18 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index ba0d8003..1dcc0b99 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -287,17 +287,9 @@ class TPage extends TTemplateControl if($this->_validators && $this->_validators->getCount()) { Prado::trace("Page validate",'System.Web.UI.TPage'); - if($validationGroup==='') - { - foreach($this->_validators as $validator) + foreach($this->_validators as $validator) + if($validator->getValidationGroup()===$validationGroup) $validator->validate(); - } - else - { - foreach($this->_validators as $validator) - if($validator->getValidationGroup()===$validationGroup) - $validator->validate(); - } } } diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php index 2d1dd612..df6c2abf 100644 --- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php +++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php @@ -36,7 +36,7 @@ class TRequiredFieldValidator extends TBaseValidator */ public function getInitialValue() { - $this->getViewState('InitialValue',''); + return $this->getViewState('InitialValue',''); } /** diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php index 111fec1e..276982ac 100644 --- a/framework/Web/UI/WebControls/TTextBox.php +++ b/framework/Web/UI/WebControls/TTextBox.php @@ -232,13 +232,8 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable */ public function raisePostDataChangedEvent() { - $page=$this->getPage(); - if($this->getAutoPostBack() && !$page->getPostBackEventTarget()) - { - $page->setPostBackEventTarget($this); - if($this->getCausesValidation()) - $page->validate($this->getValidationGroup()); - } + if($this->getAutoPostBack() && $this->getCausesValidation()) + $this->getPage()->validate($this->getValidationGroup()); $this->onTextChanged(null); } -- cgit v1.2.3