Hi,
I am using the JavaScript FCK package 2.6.4. Here is my code I used to integrate the editor in my form.
************************************************************************************************************************
<textarea rows="5" cols="53" name="story"> </textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'story') ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ToolbarSet = ''story'';
oFCKeditor.ReplaceTextarea() ;
</script>
************************************************************************************************************************
While submitting the form I am using document.form[0].story.value to get the value from the editor, but it always returns an empty string. Please suggest me how to get the editor text in this code
I am using the JavaScript FCK package 2.6.4. Here is my code I used to integrate the editor in my form.
************************************************************************************************************************
<textarea rows="5" cols="53" name="story"> </textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'story') ;
oFCKeditor.BasePath = "/fckeditor/" ;
oFCKeditor.ToolbarSet = ''story'';
oFCKeditor.ReplaceTextarea() ;
</script>
************************************************************************************************************************
While submitting the form I am using document.form[0].story.value to get the value from the editor, but it always returns an empty string. Please suggest me how to get the editor text in this code

Re: Problem in getting the textarea value
it should be document.forms[0].story.value (note the 's' on forms)
also, make sure the id is set to story for the textbox
hope this helps
Re: Problem in getting the textarea value
Now I am using the form name like document.myform.story.value.
The value is getting submitted also, but it is not available to the javascript in the same page.
For example:
On click of the submit button, I am calling a method which is having alert(document.myform.story.value).
But the alert msg is always showing an empty string.
So please tell me how to get the text entered in the editor in a javascript function.
Thanks,
Anand
Re: Problem in getting the textarea value
Make sure you got a name and id attribute on the form...and check the CaSe for the id's since Javascript is CaSe SeNsItIvE.
<html> <head> <title>Sample - CKEditor</title> <script type="text/javascript" src="./fckeditor/fckeditor.js"></script> <script type="text/javascript"> window.onload = function() { var oFCKeditor = new FCKeditor('editor1'); oFCKeditor.BasePath = "./fckeditor/"; oFCKeditor.Height = 600; oFCKeditor.ReplaceTextarea(); }; function showthing() { var t = document.myform.editor1.value; alert(t); } </script> </head> <body> <form method="post" id="myform" name="myform"> <p> My Editor:<br /> <textarea name="editor1"><p>Initial value.</p></textarea> </p> <p> <input type="button" value="Show it" onclick="showthing()" /> </p> </form> </body> </html>Hope this helps
Re: Problem in getting the textarea value
I am using IE6.
Re: Problem in getting the textarea value
Re: Problem in getting the textarea value
Unless I am not understanding the issue here. If that is not the value you are expecting, then by all means explain exactly what you want and I will try and help.
Re: Problem in getting the textarea value
But the alert message is only showing "<p>Initial Value</p>" which is the actual initial value.
Is this is clear now?please look into the image
Attachments:
Re: Problem in getting the textarea value
function showthing() { var oEditor = FCKeditorAPI.GetInstance('editor1'); alert(oEditor.GetData()); //OR alert(oEditor.GetHTML()); }http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/JavaScript_API
Re: Problem in getting the textarea value
Thanks a lot for your time.
Re: Problem in getting the textarea value