diff options
author | xue <> | 2006-01-25 04:26:27 +0000 |
---|---|---|
committer | xue <> | 2006-01-25 04:26:27 +0000 |
commit | f884ea21ea8f0c6ced02565bd647a5692f82aea4 (patch) | |
tree | 71a1f7ac242e845be02c0c7c4af2fc353222d9ef /framework/Web/UI/WebControls/TListBox.php | |
parent | 7c46396e4ade67e61dad6259030a72a783f37515 (diff) |
Added validation demo for TListBox. Fixed a few autopostback with causesvalidation problems.
Diffstat (limited to 'framework/Web/UI/WebControls/TListBox.php')
-rw-r--r-- | framework/Web/UI/WebControls/TListBox.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php index 47165c99..50cf3873 100644 --- a/framework/Web/UI/WebControls/TListBox.php +++ b/framework/Web/UI/WebControls/TListBox.php @@ -29,7 +29,7 @@ Prado::using('System.Web.UI.WebControls.TListControl'); * @package System.Web.UI.WebControls
* @since 3.0
*/
-class TListBox extends TListControl implements IPostBackDataHandler
+class TListBox extends TListControl implements IPostBackDataHandler, IValidatable
{
/**
* Adds attribute name-value pairs to renderer.
@@ -131,13 +131,8 @@ class TListBox extends TListControl implements IPostBackDataHandler */
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->onSelectedIndexChanged(null);
}
@@ -184,5 +179,15 @@ class TListBox extends TListControl implements IPostBackDataHandler {
$this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,array('Single','Multiple')),'Single');
}
+
+ /**
+ * Returns the value to be validated.
+ * This methid is required by IValidatable interface.
+ * @return mixed the value of the property to be validated.
+ */
+ public function getValidationPropertyValue()
+ {
+ return $this->getSelectedValue();
+ }
}
?>
\ No newline at end of file |