diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 9609240ec..8670948ad 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -118,6 +118,7 @@ class HTMLDisplayHandler { $output = preg_replace_callback('@(]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output); $output = preg_replace_callback('@]*\sname="'.$keys.'".+@isU', array(&$this, '_preserveSelectValue'), $output); + $output = preg_replace_callback('@]*\sname="'.$keys.'".+@isU', array(&$this, '_preserveTextAreaValue'), $output); } if(__DEBUG__==3) $GLOBALS['__trans_content_elapsed__'] = getMicroTime()-$start; @@ -180,18 +181,18 @@ class HTMLDisplayHandler { return $str.' />'; } - function _preserveSelectValue($match) + function _preserveSelectValue($matches) { $INPUT_ERROR = Context::get('INPUT_ERROR'); - preg_replace('@\sselected(="[^"]*?")?@', ' ', $match[0]); - preg_match('@@is', $match[0], $mm); + preg_replace('@\sselected(="[^"]*?")?@', ' ', $matches[0]); + preg_match('@@is', $matches[0], $mm); - preg_match_all('@]*\svalue="([^"]*)".+@isU', $match[0], $m); + preg_match_all('@]*\svalue="([^"]*)".+@isU', $matches[0], $m); - $key = array_search($INPUT_ERROR[$match[1]], $m[1]); + $key = array_search($INPUT_ERROR[$matches[1]], $m[1]); if($key === FALSE) { - return $match[0]; + return $matches[0]; } $m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]); @@ -199,6 +200,13 @@ class HTMLDisplayHandler { return $mm[0].implode('', $m[0]).''; } + function _preserveTextAreaValue($matches) + { + $INPUT_ERROR = Context::get('INPUT_ERROR'); + preg_match('@@is', $matches[0], $mm); + return $mm[0].$INPUT_ERROR[$matches[1]].''; + } + /** * @brief add html style code extracted from html body to Context, which will be * printed inside
later.