Hi, having a strange problem with FCKEditor 1.3 in a PHP scripted page.
The editor installed fine in the script (SITR 2.0 SF.Net project) as all I did was to remove the existing editor code and insert the following code:
<TD COLSPAN=5 ALIGN=LEFT BGCOLOR=\"WHITE\">";
// make a query to the database and get the document body data
$query = "SELECT data_body FROM doc_data WHERE data_id = '$data_id'";
$result = RunQuery($query);
while ($row = mysql_fetch_array($result))
{
$var_data_body = $row["data_body"];
}
$oFCKeditor = new FCKeditor ;
$oFCKeditor->Value = $var_data_body;
$oFCKeditor->CreateFCKeditor( 'fck', '100%', 400 ) ;
print "
</TD>
As you can see from the above code the I simply created an instance of the editor to fill the editor box with an existing text I made a SQL call to the database and captured the results into a variable which I passed to the editor Value option - this works great.
Only problem is I can't seem to grab any user input from the FCKEditor's edit window so nothing gets posted to the database.
The script uses a hidden form field called docpost, there is a small bit of JavaScript which process the content of the editor box and then passes the data to the form field docpost so it can be posted to the database:
<script language=\"JavaScript\">
function Processbody()
{
// Assign the HTML code to a hidden form variable
var htmlCode = document.frmbody.fck.value;
document.frmbody.docpost.value = htmlCode;
return true;
}
</script>
I used the above code with another editor similar to FCKEditor and I was able to capture the content of the edit box however I am unable to capture anything from the FCKEditor window - I tried debugging with Zend Studio however the debugger reports no value exists to post???
Can someone tell me how FCKEditor posts the data and how I can capture the contents of the editor window in FCKEditor using the bit of JavaScript above...
Thanks in advance,
Taz
The editor installed fine in the script (SITR 2.0 SF.Net project) as all I did was to remove the existing editor code and insert the following code:
<TD COLSPAN=5 ALIGN=LEFT BGCOLOR=\"WHITE\">";
// make a query to the database and get the document body data
$query = "SELECT data_body FROM doc_data WHERE data_id = '$data_id'";
$result = RunQuery($query);
while ($row = mysql_fetch_array($result))
{
$var_data_body = $row["data_body"];
}
$oFCKeditor = new FCKeditor ;
$oFCKeditor->Value = $var_data_body;
$oFCKeditor->CreateFCKeditor( 'fck', '100%', 400 ) ;
print "
</TD>
As you can see from the above code the I simply created an instance of the editor to fill the editor box with an existing text I made a SQL call to the database and captured the results into a variable which I passed to the editor Value option - this works great.
Only problem is I can't seem to grab any user input from the FCKEditor's edit window so nothing gets posted to the database.
The script uses a hidden form field called docpost, there is a small bit of JavaScript which process the content of the editor box and then passes the data to the form field docpost so it can be posted to the database:
<script language=\"JavaScript\">
function Processbody()
{
// Assign the HTML code to a hidden form variable
var htmlCode = document.frmbody.fck.value;
document.frmbody.docpost.value = htmlCode;
return true;
}
</script>
I used the above code with another editor similar to FCKEditor and I was able to capture the content of the edit box however I am unable to capture anything from the FCKEditor window - I tried debugging with Zend Studio however the debugger reports no value exists to post???
Can someone tell me how FCKEditor posts the data and how I can capture the contents of the editor window in FCKEditor using the bit of JavaScript above...
Thanks in advance,
Taz
RE: Editor box, no value being sent to form field
RE: Editor box, no value being sent to form field
$oFCKeditor->CreateFCKeditor( 'fck', '100%', 400 );
with:
$oFCKeditor->CreateFCKeditor( 'docpost', '100%', 400 );
and remove the javascript function.
Don't forget: You must be between <form> and </form> tags when you call the $oFCKeditor->CreateFCKeditor() function.
FCKeditor will put a hidden field with name set to 'docpost' in your form witch is updated with the content of the editor before the form is submitted.
That's all