12/16/13

Using jquery form with TinyMCE - form content does not submit

After struggling mightily with this problem I finally found the solution courtesy of Jerome Jaglale. TinyMCE is creating (behind the scenes) an iFrame to actually contain the human visible HTML rendered content. Unfortunately the form when submitted via JQuery Form sees on 'real' textarea - making it impossible to submit the HTML friendly user visible content. The solution was simply to add this line just after the form is assigned:

// bind form using 'ajaxForm'

$('form.form-horizontal').ajaxForm(options); 

//now update the 'real textarea' with the TinyMCE rendered content
$('form').bind('form-pre-serialize', function(e) {
    tinyMCE.triggerSave();
});

Worked like a charm! Original Post: http://jeromejaglale.com/doc/javascript/tinymce_jquery_ajax_form

No comments:

Post a Comment