tiny mce strips content while posting

113 Views Asked by At

I'm using tiny mce in my project which was built using Kohana 3.0.7. If I try to add content to the editor and submit the form, the content is saved properly. But, if there is a validation error and the same page with the validation errors is displayed, there is some issue. After correcting the validation error and adding more content to the mce editor, when I try to post, only the content which was posted at the first attempt is posted. The content which I add after is lost.

I have confirmed this with a plain text-area and sure the editor is causing this. How can I fix this ?

1

There are 1 best solutions below

0
On

Looks like your textarea content does not get updated after an error. You may do this manually by calling tinymce.triggerSave(); in your javascript console (firebug or similar tool). triggerSave() orders all tinymce instances to write their content back to the html elment they had been created for.

Update: A javascript console is available using firebug or some other developertools (browser addons). What you need to have it functional all of the time is to use the setup init parameter and a handler: XXXX stands for the handler you will need (an event fired when you post)

setup: function(ed){
    ed.onXXXX.add(function(ed, evt){
        //console.log('paste');
        tinymce.triggerSave();
    });
},