Basically I'm trying to change the HTML value of text area after oFCKeditor.Create() has been called. The reason for this is b/c I have a select drop down in which a user chooses a template, and I'd like it to auto fill the text area dynamically from a database depending on which template is chosen. I'm using remote scripting to pull the data from a database, but I can't seem to replace the existing text within the FCKeditor textbox.
Any ideas?
Alex
Any ideas?
Alex
RE: Change value after editor has loaded
function myCallback( returnstring ){
document.getElementById("project_description").value = returnstring; // set's value for form
FCK = FCKeditorAPI.GetInstance('project_description'); // Loads instance of fckeditor to FCK
FCK.Focus();
FCK.SetHTML( "", true ) ; // Clears the current HTML in the textarea (otherwise it appends)
FCK.InsertHtml(returnstring); // Inserts returnstring
}
The only thing left to do is to have the returnstring keep it's formating.
Alex
RE: Change value after editor has loaded
FCK.InsertHtml(returnstring); // Inserts returnstring
was giving me a jscript error. What I did was tweak your code as follows:
document.getElementById("project_description").value = returnstring; // set's value for form
FCK = FCKeditorAPI.GetInstance('project_description'); // Loads instance of fckeditor to FCK
FCK.Focus();
FCK.SetHTML( returnstring, true ) ; // Clears the current HTML in the textarea (otherwise it appends)
and it works fine.
Richard
p.s. I am using ver 2.4 of FCKEditor