Details
Description
Here is the form:
$this->addElement(
'TextBox',
'Title',
array(
'label' => 'News Title:',
'required' => true,
'validators' => array(
array('NotEmpty', true),
),
)
);
$this->addElement(
'Editor',
'Content',
array(
'label' => 'News Content:',
'required' => true,
'height' => '150px',
'focusOnLoad' => true,
'validators' => array(
array('NotEmpty', true),
),
)
);
If there is a validation error, the Editor will set the value to "Array".
Because there are two elements named "Content", see the following html code:
<input id="Content" name="Content" value="" type="hidden" /><textarea id="Content[Editor]" name="Content[Editor]" type="text" height="150px" focusOnLoad="1" required="1" dojoType="dijit.Editor"></textarea>
And the solution is change the textarea element's id and name.
Open the Zend/Dojo/View/Helper/Editor.php:
change the following code:
protected function _normalizeEditorName($name)
{
if ('[]' == substr($name, -2)) {
$name = substr($name, 0, strlen($name) - 2);
$name .= '[Editor][]';
} else {
$name .= '[Editor]';
}
return $name;
}
to:
protected function _normalizeEditorName($name)
{
if ('[]' == substr($name, -2)) {
$name = substr($name, 0, strlen($name) - 2);
$name .= '-Editor[]';
} else {
$name .= '-Editor';
}
return $name;
}
Hope that helps.
Regard,
Justin
Issue Links
| This issue is related to: | ||||
| ZF-8127 | Security issue in Zend_Dojo_View_Helper_Editor |
|
|
|
Another solution is:
Open the Zend/Dojo/View/Helper/Editor.php file:
change the following code:
$html = '<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket()
. $this->textarea($textareaName, $value, $params, $attribs);
to:
$html = $this->textarea($textareaName, $value, $params, $attribs)
.'<input' . $this->_htmlAttribs($hiddenAttribs) . $this->getClosingBracket();