I am creating a new module and in that module I add a form which has a field name content in the database.

Now when I add a wyswig editor in this form with the field name content in the database, the layout of the form in the backend changes completely as compared to default layout.

But when I changed the database field name from content to any other name lets say content_html or content_h etc etc., the layout of the form now appeared as a default form.

This happens only when I use wyswig editor, and without wyswig if I create simple form it accepts the values in the database under the content field name.

Why can't magento accept the content as a field name, using wyswig editor.

  • I assume this has something to do with tinymce stripping tag. But why it would only do it when something is named "content" is beyond me. Have a look at alanstorm.com/magento_html5_tinymce for some more info Commented May 21, 2014 at 13:02
  • Justus Krapp gives the thought here but still I didn't understand properly.
    – Waseem
    Commented May 22, 2014 at 4:56

1 Answer 1


Just so this will have an answer.... Based on the post mentioned in the comments.

You cannot have a field named content because, in this case magento creates the following textarea

<textarea name="content" id="content"...></textarea>

Now comes the tinymce js that tries to turn your textarea into a WYSIWYG editor. It looks for the element with id content, but this element already exists higher in the DOM.

<div class="main-col" id="content">

This causes an malfunction.

So basically the problem is not that your element (or table column) has the name content. The problem is that the id of the element is content.

Magento actually has an entity with a field name content and works just fine. It is Cms page entity.

Take a look at Mage_Adminhtml_Block_Cms_Page_Edit_Tab_Content::_prepareForm. You will see this:

$contentField = $fieldset->addField('content', 'editor', array(
    'name'      => 'content',
    'style'     => 'height:36em;',
    'required'  => true,
    'disabled'  => $isElementDisabled,
    'config'    => $wysiwygConfig

The solution is to have a different id for the textarea.
In order to achieve this you can use


This transforms all the ids for the elements in the form from elemId to some_prefix_ememId.

In your case content becomes some_prefix_content and everything should work.

  • and discard my draft answer :) Commented May 26, 2014 at 7:33
  • @Marius thanks for giving the details. It really help me to understood this.
    – Waseem
    Commented May 26, 2014 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.