From 0d682e512ad1d07434320ace888c88511fb8426b Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 28 Sep 2007 02:01:43 +0000 Subject: Fix prompt selection behavior. --- framework/Web/UI/WebControls/TDropDownList.php | 4 ++-- framework/Web/UI/WebControls/TListControl.php | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'framework/Web/UI') diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php index 883073c5..1710d316 100644 --- a/framework/Web/UI/WebControls/TDropDownList.php +++ b/framework/Web/UI/WebControls/TDropDownList.php @@ -29,8 +29,8 @@ Prado::using('System.Web.UI.WebControls.TListControl'); * * * Since v3.1.1, TDropDownList starts to support prompt text. That is, a prompt item can be - * displayed as the first list item by specifying {@link setPromptText PromptText}. Choosing - * the prompt item will unselect the TDropDownList. + * displayed as the first list item by specifying either {@link setPromptText PromptText} or + * {@link setPromptValue PromptValue}, or both. Choosing the prompt item will unselect the TDropDownList. * * @author Qiang Xue * @version $Id$ diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index 6e478550..785bd194 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -704,7 +704,7 @@ abstract class TListControl extends TDataBoundControl implements IDataRenderer } /** - * @return string the prompt text which is to be displayed as the first list item. Defaults to empty, meaning no prompt. + * @return string the prompt text which is to be displayed as the first list item. * @since 3.1.1 */ public function getPromptText() @@ -713,7 +713,7 @@ abstract class TListControl extends TDataBoundControl implements IDataRenderer } /** - * @param string the prompt text which is to be displayed as the first list item. If empty, {@link getPromptValue PromptValue} will be displayed. + * @param string the prompt text which is to be displayed as the first list item. * @since 3.1.1 */ public function setPromptText($value) @@ -722,7 +722,7 @@ abstract class TListControl extends TDataBoundControl implements IDataRenderer } /** - * @return string the prompt selection value. Defaults to empty, meaning no prompt. + * @return string the prompt selection value. * @see getPromptText * @since 3.1.1 */ @@ -773,11 +773,9 @@ abstract class TListControl extends TDataBoundControl implements IDataRenderer { $text=$this->getPromptText(); $value=$this->getPromptValue(); - if($text==='') - $text=$value; if($value==='') $value=$text; - if($text!=='') + if($value!=='') { $writer->addAttribute('value',$value); $writer->renderBeginTag('option'); -- cgit v1.2.3