Moose Moose
Moose Moose

Reputation: 267

ckeditor set textarea value

I can't get the correct value from the textarea

<textarea class="ckeditor" name="cmscontent" id="cmscontent"></textarea>
<script type="text/javascript">
    CKEDITOR.replace('cmscontent');
</script>

I'm using a JSON request to send it to the server, and the $_POST['cmscontent'] value stays empty all the time. Is there something else I have to do?

Upvotes: 0

Views: 1890

Answers (1)

Reinmar
Reinmar

Reputation: 22023

You need to call editor.updateElement() before you send AJAX request saving content. This method will update the textarea element with contents of the editor.

You can get the editor instance from CKEDITOR.replace() or from instances object - CKEDITOR.instances.cmscontent.

Upvotes: 1

Related Questions