Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor submit value empty (no ajax)

Tags:

html

php

ckeditor

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

like image 680
waza-ari Avatar asked Jun 08 '26 14:06

waza-ari


1 Answers

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();
    }
}
like image 54
Zach Leighton Avatar answered Jun 11 '26 02:06

Zach Leighton