In older versions this was possible by using document.frames[0].objContent.DOM.body.innerHTML but this value does not work in version 2.0 beta 1.
What I am trying to do is upgrade an implementation using the older version to the new version as it supports mozilla.
the functionality is as follows:
main editing page (p.A) contains a textarea and a link which opens a popup (p.B) with an instance of tfckeditor. the popup takes the value of p.A.textarea and inserts it in the fckeditor area (oFCKeditor.Value = opener.document.form1.<%=parentField%>.value;)
after editing the contents of the popup window, the user clicks on "save" button which passes the fckeditor value to the parent and closes the popup
opener.document.form1.<%=parentField%>.value=document.frames[0].objContent.DOM.body.innerHTML; window.close();
How do I do this last part with version 2.0 of the FCKEditor?
Thank you in advance!
-- Andre
What I am trying to do is upgrade an implementation using the older version to the new version as it supports mozilla.
the functionality is as follows:
main editing page (p.A) contains a textarea and a link which opens a popup (p.B) with an instance of tfckeditor. the popup takes the value of p.A.textarea and inserts it in the fckeditor area (oFCKeditor.Value = opener.document.form1.<%=parentField%>.value;)
after editing the contents of the popup window, the user clicks on "save" button which passes the fckeditor value to the parent and closes the popup
opener.document.form1.<%=parentField%>.value=document.frames[0].objContent.DOM.body.innerHTML; window.close();
How do I do this last part with version 2.0 of the FCKEditor?
Thank you in advance!
-- Andre
RE: getting the current textarea value via JS
<!--- form for editor with also other fields --->
<form method="POST" name="frm_editor" action="<cfoutput>#cgi.script_name#</cfoutput>" onSubmit="">
<cfscript>
fckEditor = createObject("component", "editor/fckeditor/fckeditor");
fckEditor.instanceName = "textEditor";
//fckEditor.value = form.valore;
fckEditor.value = "#formatta(form.valore)#";
//fckEditor.value = 'w la mamma';
fckEditor.basePath = "editor/fckeditor/";
fckEditor.width = "100%";
fckEditor.height = "95%";
fckEditor.create(); // create the editor.
</cfscript>
<cfoutput>
<input type="Hidden" name="nome_form" value="#form.nome_form#">
<input type="Hidden" name="nome_campo" value="#form.nome_campo#">
<input type="Hidden" name="menu" value="false">
</cfoutput>
</form>
<!--- so with javascript I recall value: --->
editor_value=document.frm_editor.textEditor.value;
Bye!
RE: getting the current textarea value via JS
document.frm_editor.textEditor.value;
but I got "Error: document.frm_editor.textEditor has no properties"
Then I tried using your method for creating the editor object
fckEditor = createObject("component", "editor/fckeditor/fckeditor");
fckEditor.instanceName = "textEditor";
instead of
oFCKeditor = new FCKeditor('txtEditor') ;
oFCKeditor.BasePath = sBasePath ;
and got an error saying that "createObject is not defined."
Is it really that difficult to access the content of the editor? Please help!
-- Andre
Here's the code I use
<SCRIPT language="javascript">
var sBasePath = "/stage/_admin/FCKEditor/";
oFCKeditor = new FCKeditor('txtEditor') ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Width = '610' ;
oFCKeditor.Height = '550' ;
oFCKeditor.ToolbarSet = 'AccessibilityNoImages' ;
oFCKeditor.Value = opener.document.form1.<%=parentField%>.value;
oFCKeditor.CanUpload = false ;
oFCKeditor.CanBrowse = false ;
oFCKeditor.Create() ;
</SCRIPT>
<!-- THE CODE BELOW used to work for the old version and I am trying to find an equivalent for the new version. -->
<INPUT name="Button3" type="button" onclick="opener.document.form1.<%=parentField%>.value=document.frames[0].objContent.DOM.body.innerHTML; window.close(); " value="Save Changes">
problem with editor_value=document.frm_editor
the problem with this value is that it does not reflect the changes made in the text field. It only shows the initial value of the editor, no matter what happens in the textarea.