Hi,
I've written a custom form element to implement then wysiwygPro editor in my
forms. However, when adding the editor element, the element is generated
above the form. So when submitting the form, the editor content will not be
submitted. Is there something I missed here? Below the code of my element
files:
in the form I have:
$this->addElement('editor', 'content',
array(
'decorators' => $this->_standardElementDecorator,
'label' => 'Content',
'attribs' => array(
'editorParams' => array(
'instance'=>'content',
'width'=>600,
'height'=>600,
'value'=>'Content here'
)
)
)
);
the Element code is:
require_once 'Zend/Form/Element/Xhtml.php';
class eCMS_Form_Element_Editor extends Zend_Form_Element_Xhtml {
public $helper = 'formEditor';
}
the View Helper code is:
class eCMS_View_Helper_FormEditor extends Zend_View_Helper_FormElement {
public function formEditor($name, $value = null, array $attribs
= null){
include_once('_editor/wysiwygPro/wysiwygPro.class.php');
$info = $this->_getInfo($name, $value, $attribs);
extract($info);
$params = null;
if(isset($attribs['editorParams'])){
$params = $attribs['editorParams'];
unset($attribs['editorParams']);
}else{
throw new Zend_View_Exception('WysiwygPro
editor params are missing from
attributes');
}
$editor = new wysiwygPro();
$editor->editorURL = '/_editor/wysiwygPro/';
$editor->loadPlugins(array('tagPath', 'eConfig'));
$editor->name = $params['instance'];
$editor->width = $params['width'];
$editor->height = $params['height'];
$editor->value = $params['value'];
$xHTML = $editor->display();
return $xHTML;
}
}
--
View this message in context:
http://www.nabble.com/custom-Form-element-gets-scripted-outside-the-form-tp17773858p17773858.html
Sent from the Zend Framework mailing list archive at Nabble.com.