Posted on 2007-09-28
Here's my code in full:
// Various code before
var fck = new FCKeditor( "myFCKeditor" );
fck.BasePath = '/iwo/FCKeditor/';
fck.Value = divContent.innerHTML;
fck.ToolbarSet = 'Basic';
alert( "Creating FCK" );
divContent.innerHTML = fck.CreateHtml();
alert( "Saving" );
var editor = FCKeditorAPI.GetInstance( "myFCKeditor" );
var contentDiv = document.getElementById( contentSectionInEdit );
contentDiv.innerHTML = editor.GetHTML();
alert( "Submitting" );
// Various processing code.
function FCKeditor_OnComplete( editorInstance )
alert("FCK instance loaded");
editorInstance.LinkedField.form.onsubmit = doSave;
The editSection function is called when I click an edit button on my HTML form. As you can see it creates an FCKeditor instance and when that process is complete the FCKeditor_OnCompletefunction is invoked and the save button on the FCKeditor instance is associated with my doSave function. The doSave function is invoked successfully, gets the contents of my instance and updates my form fine. However, when I now click my "Save Changes" button in successfully calls my submitForm function but the line
document.managePagesForm.submit(); doesn't do anything. If I click the "Save Changes" button without clicking the edit button first the form is successfully submitted to PHP because the
FCKeditor_OnComplete function has not been invoked and the onsubmit event not changed. I cannot make my "Save Changes" button of type submit because I need to execute the
submitForm function before the form is sent to PHP.
Hope that is understandable.