Search code examples
phphtmlckeditor

CKEditor submit value empty (no ajax)


I have a problem with the ckeditor. I downloaded the current version and included it to my form as follows:

<form action="/news.php?frame=edit&amp;id=185" enctype="multipart/form-data" method="post" accept-charset="utf-8">
<textarea class="edit" name="news_content" id="news_content" rows="30" cols="32" style="width:95%;">{$news_content}</textarea>
<script type="text/javascript" src="ext/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
     CKEDITOR.replace( 'news_content' )
</script>
<input type="submit" accesskey="s" value="Eintragen (Alt+S)" class="button">
</form>

It is loaded correctly and I can use the editor to make any changes. However, when submitting the form using a normal submit button (no AJAX or JS at all here), there is no entry "news_content" in the $_POST array, nor is there any other element containing the data at all.

How can I make use of the content after submitting the form using a normal submit button?

Thanks in advance and best regards Daniel


Solution

  • You have to run a function to update the actual form field, I had the same issue let me find my code. The actual form data doesn't get updated until you run a function to move the CKEditor data into the form field.

    function updateAllMessageForms()
    {
        for (instance in CKEDITOR.instances) {
                CKEDITOR.instances[instance].updateElement();
        }
    }