I want to be able to access the value/content in the editing area via JavaScript. I cannot seem to identify the proper object path to access this.
Here is some sample code:
<form name="editor">
<div>
<input type="hidden" id="FCKeditor1" name="FCKeditor1" value="" style="display:none" />
<input type="hidden" id="FCKeditor1___Config" value="SkinPath=/fckeditor/skins/office2007/" style="display:none" />
<iframe id="FCKeditor1___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=FCKeditor1&Toolbar=Default" width="685" height="500" frameborder="0" scrolling="no"></iframe>
</div>
</form>
Since the form posts the editing area text as the field FCKeditor1, I figured I could access the value via JavaScript using "document.editor.FCKeditor1.value", but that does not work since the editing area is not part of a form and is in the iframe. I tried accessing document.getElementById('FCKeditor1___Frame').document, but that comes up undefined.
Does anyone know the object path to access this? Is there a built-in method to get this value I am missing?
Thanks
Here is some sample code:
<form name="editor">
<div>
<input type="hidden" id="FCKeditor1" name="FCKeditor1" value="" style="display:none" />
<input type="hidden" id="FCKeditor1___Config" value="SkinPath=/fckeditor/skins/office2007/" style="display:none" />
<iframe id="FCKeditor1___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=FCKeditor1&Toolbar=Default" width="685" height="500" frameborder="0" scrolling="no"></iframe>
</div>
</form>
Since the form posts the editing area text as the field FCKeditor1, I figured I could access the value via JavaScript using "document.editor.FCKeditor1.value", but that does not work since the editing area is not part of a form and is in the iframe. I tried accessing document.getElementById('FCKeditor1___Frame').document, but that comes up undefined.
Does anyone know the object path to access this? Is there a built-in method to get this value I am missing?
Thanks

Has anyone figured out a way to get the current value of the editor from Javascript?
If I create the editor and pass it an ID like "test123", and then call CreateHtml(), it creates a hidden INPUT field with that ID, but the ID doesn't get an updated value as I type. So I'm confused about how one is supposed to go about getting the value.
- Jim
First off, the value is not automatically stuffed into an INPUT field like I'd expected. Secondly, there is an editor instance which has a GetHTML method but that instance is NOT the same as the object you create with "new FCKeditor()". They are entirely different.
Now the solution.
var editor = new FCKeditor("test123"); // ... Then later, to get the value var inst = FCKeditorAPI.GetInstance("test123"); var sValue = inst.GetHTML();- Jim
thanks
i'm not sure how correct this is..but as my function was picking up the correct textarea (but not its contents) and storing its name in a var, i have just used this var like so
for(var i = 0;i < fobj.elements.length;i++) { formEl = fobj.elements[i]; switch(formEl.type) { case "textarea": var inst = FCKeditorAPI.GetInstance(formEl.name); var sValue = inst.GetHTML(); //etcvar editor = new FCKeditor(eleFckComment);
var inst = FCKeditorAPI.GetInstance(eleFckComment);
alert(inst.GetHTML());
where eleFckComment is the name of my element on the page (i.e. fckComment) and it gives me a error on FCKeditor being not defined. Any ideas on what I am doing wrong here?