I was using TinyMCE in an app, and it was working fine until I started using AjaxSubmitButton to submit the form. When Ajax calls were made, the content of the textarea that TinyMCE attachs itself didn't send any updated values, it was the old value over and over again. Checking network trafic showed that the old value was send with the submit, not the new value.

After searching the mailing lists, I saw this thread :

http://article.gmane.org/gmane.comp.web.webobjects.wonder-disc/11754

And it did the trick! So in summary, you need to add this after your call to TinyMCE.init :

var saveOnSubmit = function() {
  tinyMCE.activeEditor.save();
  $('<wo:str value="$^id"/>').form.stopObserving('ajax:submit', arguments.callee);
};

$('<wo:str value="$^id"/>').form.observe('ajax:submit', saveOnSubmit);
$('<wo:str value="$^id"/>').form.observe('submit', saveOnSubmit);

Where id = the (HTML attribute) id of the text area where TinyMCE is attached to.

  • No labels