function gb_form()
{
include('../koder/fckeditor/fckeditor.php');
$oFCKeditor = new FCKeditor('gb_form') ;
$oFCKeditor->BasePath = '../koder/fckeditor/';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '400px';
$oFCKeditor->ToolbarSet = 'Default';
$oFCKeditor->Create();
}
function add_guest($profil)
{
$ret .= '<div class="main_info">';
$ret .= 'Add to guestbook.';
<form id=\"gb\" name=\"gb\" method=\"post\" action=\"koder/guestbook.php\" onsubmit=\"getHtmlData( \'profil_vis\', \'koder/guestbook.php?show_only=guestbook&name='.$profil.'\'); return false;">
<input type=\"hidden\" id=\"owner\" name=\"owner\" value=\"".$profil."\">";
$ret .= gb_form();
$ret .= "
<input type=\"submit\" name=\"gb_post\" value=\"Add\" >
</form>";
$ret .= '</div>';
return $ret;
}
Fri, 12/12/2008 - 01:42
#1

Re: FCKeditor and submit with XMLHttpRequest
in the form, the data is sent to guestbook, but then the whole page updates and return the guestbook.php page
Re: FCKeditor and submit with XMLHttpRequest
function savePage() { showWait(); // a function to show a wait symbol and gray out other stuff var oEditor = FCKeditorAPI.GetInstance('my_editor'); oEditor.UpdateLinkedField(); data = $('my_form').serialize(); container_div = $('page').value; // in the form I have <input type='hidden' name='page' /> // this lets me know later what to update full_text = $('my_editor').value; // with the contents from this new Ajax.Request('page-saver.php', { parameters: data, method: 'post', onSuccess: function(transport) { $(container_div).innerHTML = full_text; $('editor-container').hide(); showWait(false); } } ); return true; }Oh yeah, and you'll want to attach that to a form and return false, like....:
$('my-form').observe('submit', function() { savePage(); return false; });