Hi,
I create the editor by replacing a textarea that is added dynamically. This might be weird but using fck.CreateHTML for innerHTML worked, but I was not able to set a Value, because I had to wait until the editor was available in FCKeditorAPI. Or is there another way to set Values????
Now clicking on the save button, gives me a "FCK not defined" and I can't find a solution. Saving works but I don't want to have JS errors in FF????
Regards
Spanky
I create the editor by replacing a textarea that is added dynamically. This might be weird but using fck.CreateHTML for innerHTML worked, but I was not able to set a Value, because I had to wait until the editor was available in FCKeditorAPI. Or is there another way to set Values????
/**
* @param {Object} obj The HTML-DOM object of the element to be edited
* @param {String} id The id of the HTML element
*/
function createEditorAtObject(obj, id){
// we will use a WYSIWYG editor now
var fck = new FCKeditor('myFCKeditor__'+ id);
fck.BasePath = 'javascript/fckeditor/';
// creation with Create didn't work, so we create a text area and then replace it
obj.innerHTML = "<form onsubmit=''><textarea cols='85' rows='5' type='text' id='myFCKeditor__"+ id +"' >"+ value +"</textarea></form>";
fck.ReplaceTextarea();
}
function mySaveFunction(){
// get the editor from the <form> element (this)
var completeid = this.firstChild.id.split('__'); // creating with fck.CreateHTML had problems getting the instance
var editorId = completeid[0] + '__' + completeid[1];
var oEditor = FCKeditorAPI.GetInstance(editorId); // I do get the editor
// get the parent Element and replace editor with
var myobj = this.parentNode; // I get the parent element and replace the editor with the value
myobj.innerHTML = oEditor.GetData(); // works
// delete instances
delete(oEditor);
delete(FCKeditorAPI.Instances[editorId]);
return false; //this disables default action (submitting the form)
}
function FCKeditor_OnComplete( editorInstance ){
editorInstance.LinkedField.form.onsubmit = mySaveFunction;
}
Now clicking on the save button, gives me a "FCK not defined" and I can't find a solution. Saving works but I don't want to have JS errors in FF????
Regards
Spanky
