summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TClientScriptManager.php
diff options
context:
space:
mode:
authorxue <>2005-12-12 02:32:56 +0000
committerxue <>2005-12-12 02:32:56 +0000
commita7107dbd87aa92462a7348c1e73cd73da42cf4d8 (patch)
treeaab6e973c2bfd2b1276187daee6ce8fbcfa54ce9 /framework/Web/UI/TClientScriptManager.php
parent5c2ac61fe0f0c892cd9934651d86a28b037a4386 (diff)
Modified rendering logic of hidden fields so that they are rendered at both the beginning and ending of the form.
Diffstat (limited to 'framework/Web/UI/TClientScriptManager.php')
-rw-r--r--framework/Web/UI/TClientScriptManager.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 27029f56..cc5289c5 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -280,7 +280,9 @@ class TClientScriptManager extends TComponent
public function registerHiddenField($name,$value)
{
- $this->_hiddenFields[$name]=$value;
+ // if the named hidden field exists and has a value null, it means the hidden field is rendered already
+ if(!isset($this->_hiddenFields[$name]) || $this->_hiddenFields[$name]!==null)
+ $this->_hiddenFields[$name]=$value;
}
public function registerOnSubmitStatement($key,$script)
@@ -365,8 +367,14 @@ class TClientScriptManager extends TComponent
$str='';
foreach($this->_hiddenFields as $name=>$value)
{
- $value=THttpUtility::htmlEncode($value);
- $str.="<input type=\"hidden\" name=\"$name\" id=\"$name\" value=\"$value\" />\n";
+ if($value!==null)
+ {
+ $value=THttpUtility::htmlEncode($value);
+ $str.="<input type=\"hidden\" name=\"$name\" id=\"$name\" value=\"$value\" />\n";
+ // set hidden field value to null to indicate this field is rendered
+ // Note, hidden field rendering is invoked twice (at the beginning and ending of TForm)
+ $this->_hiddenFields[$name]=null;
+ }
}
if($str!=='')
$writer->write("<div>\n".$str."</div>\n");