diff options
author | xue <> | 2006-03-22 00:47:13 +0000 |
---|---|---|
committer | xue <> | 2006-03-22 00:47:13 +0000 |
commit | 8e3f265f1e502ba3011888b725045406193ce8e8 (patch) | |
tree | 20388c90dba9134d1a465f5ed3b13ca439ad8948 /framework/Web/UI | |
parent | a31c95cfdb23a9dd068759249389c4a9c0734511 (diff) |
Added support to array-typed hidden field.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/TClientScriptManager.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 01be9944..015ef1c1 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -285,7 +285,8 @@ class TClientScriptManager extends TApplicationComponent /** * Registers a hidden field to be rendered in the form. * @param string a unique key identifying the hidden field - * @param string hidden field value + * @param string|array hidden field value, if the value is an array, every element + * in the array will be rendered as a hidden field value. */ public function registerHiddenField($name,$value) { @@ -446,8 +447,15 @@ class TClientScriptManager extends TApplicationComponent { if($value!==true) { - $value=THttpUtility::htmlEncode($value); - $str.="<input type=\"hidden\" name=\"$name\" id=\"$name\" value=\"$value\" />\n"; + if(is_array($value)) + { + foreach($value as $v) + $str.='<input type="hidden" name="'.$name.'[]" id="'.$name.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; + } + else + { + $str.='<input type="hidden" name="'.$name.'" id="'.$name.'" value="'.THttpUtility::htmlEncode($value)."\" />\n"; + } // set hidden field value to true to indicate this field is rendered // Note, hidden field rendering is invoked twice (at the beginning and ending of TForm) $this->_hiddenFields[$name]=true; |