I recently found out that an <input type="reset"> has no effect on an instance of FCKeditor. To make sure any editors are reset as well when the form is reset, I've written a JavaScript function (tested and working in Firefox 2.0, IE 6.0 and IE 7.0).
<?php
$oForm = new FormHandler("DemoForm", "demo.php", "onreset='resetEditors();'");
$oForm->addHTML("<script type='text/javascript' src='resetEditor.js'></script>");
$oForm->setValue("text", "Initial value for the textfield");
$oForm->setValue("fck", "<p>Initial value for the <strong>FCKeditor</strong></p>");
$oForm->flush();
?>
The JavaScript is surprisingly short, because FCKeditor delivers an API to the browser that can be used:
function resetEditors()
{
// If the editor API does not exist, there are no editors
if (typeof FCKeditorAPI == "undefined") return;
// Loop through all FCK instances, in case there are several editors
for (var sEditorName in FCKeditorAPI.__Instances)
{
// The initial value that was set when the form was created
// is stored in a hidden <INPUT> with the same name as the
// editor (the editor itself is in an <IFRAME> with ___Frame
// appended to the name. Check whether that INPUT exists
if (document.getElementById(sEditorName))
{
// Get the initial value
var sInitialValue = document.getElementById(sEditorName).value;
// Overwrite the editor's current value
FCKeditorAPI.__Instances[sEditorName].SetHTML(sInitialValue);
}
}
}
For those who ran into this problem and couldn't find a way to fix it, enjoy!