IE9 TinyMCE ajax save problem
I have few tabs in one page and in one of the tab i have three textareas(all containing TinyMCE) editors.
I m using ajax to post form and save values and then redisplaying partial view which is returned from the PartialViewResult.
I m using latest version(3.5.8) of TinyMCE.
When i click first time, the textarea values are saved. but when i click second time the tab gets disappeared and gives me 'SCRIPT70: Permission denied'.
The error is occured in tiny_mce_src.js at
getBody : function() {
return this.bodyElement || this.getDoc().body;
}
I have tried using document.domain = 'localhost'(written at the top of the tiny_mce_src.js), it works but only one textarea convert into TinyMCE editor and the other two remains as proper textarea.
Also tried setting this to 1(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_OBJECT_CACHING\iexplore.exe)
My code for posting form and redisplaying is as follows.
$(".save").live("click", function () {
tinyMCE.triggerSave();
var f = $(this).parents("form");
var action = f.attr("action");
var serializedForm = f.serialize();
$.ajax({
type: 'POST',
url: action,
data: serializedForm,
async: false,
cache: false,
success: function (data, textStatus, request) {
// redisplay partial view
$("div.tab-pane.active").html(data);
window.scrollTo(0, 0);
InItTinyMCE();
},
error: function (req, status, error) {
alert("Error occurred!");
}
});
return false;
});
function InItTinyMCE() {
tinyMCE.init({
mode: "textareas",
cleanup: true
});
}
please help.
You might have to reinitialize the tinymce instances correctly
To shut down an edtor instance use:
tinymce.execCommand('mceRemoveControl',true,'your_editor_id');
To reinitialize use
tinymce.execCommand('mceAddControl',true,'your_editor_id');