Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tinyMCE triggerSave not working

Im trying to submit a form with a tinyMCE textarea. Im submitting the form via javascript, and in order to do this i know you have to call tinyMCE.triggerSave to copy the contents of the editor to the hidden textarea it replaces. For the life of me i can NOT get tinyMCE.triggerSave to do ANYTHING. I know its not because i run the command from the safari and firefox debug tools and nothing in the DOM changes.

Other than this problem tinyMCE seems to be working fine, the form shows up and works. I just cant submit it.

EDIT: even if i use a standard form submit button it does not pick up the content.

like image 758
Michael Avatar asked Jun 22 '10 22:06

Michael


2 Answers

You can also run into this problem if you initialize the same editor twice using tinymce.execCommand('mceAddControl', true, id);

No error will be shown but the triggerSave function will fail silently.

like image 114
Phil McCullick Avatar answered Oct 06 '22 14:10

Phil McCullick


I included the tinyMCE js files twice. I had

= include_tiny_mce_if_needed

in my application template, and i had

- content_for(:head, include_tiny_mce_if_needed)

in my view file ... BAD

Caused me hours of frustration.

like image 28
Michael Avatar answered Oct 06 '22 12:10

Michael