Home » Magento28 January 2013

Magento: TinyMCE not displayed / Shows error

I was working with a custom Magento module. I had to display TinyMCE editor in an admin form field.

I was getting this error when I try to add/edit data from the custom module:-

Warning: Invalid argument supplied for foreach() in lib\Varien\Data\Form\Element\Editor.php on line 225

I tried some workaround and was able to see the form in admin but still tinymce editor was not displayed on the desired form field.

I was getting this error on firebug console:-

tinyMceWysiwygSetup is not defined

Finally this solution helped me:-

http://www.magentocommerce.com/boards/index.php/viewthread/176212/P30/#t402235

Here are the steps that I followed:-

1) Ensure that the editor is enabled in your shop
It is enabled by default. You can check it from
System -> Configuration -> [GENERAL] -> Content Management -> Enable WYSIWYG Editor -> Enabled by default

2) Preparing editor used in edit form
app/code/local/Mynamespace/Mymodule/Block/Adminhtml/Mymodule/Edit.php

3) Transforming textarea to editor

app/code/local/Mynamespace/Mymodule/Block/Adminhtml/Mymodule/Edit/Tab/Form.php

Include the content within ‘_prepareForm()‘ function

Note: One important thing to notice is that I also had problem when my editor field name and id was ‘content’. It contradicts with some other id in the page. Hence, TinyMCE editor is not displayed properly. You should change it to other name. Like, I have named it ‘mycontent’.

4) Clear Cache

Now, TinyMCE should work fine.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Wing Beelezemon Wingzemon X

    Thank you man! You save my life :)

  • deepika

    it’s not working in my custom module with control name “description” :(