Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
147
rated 0 times [  151] [ 4]  / answers: 1 / hits: 62688  / 14 Years ago, tue, august 31, 2010, 12:00:00

I am running CKeditor 3.4 on a pretty simple page. I am having a problem (sometimes) where when I call document.main_form.submit(), it will not send along the contents of the textarea. After some reading, it sounds like CKeditor is not destroying properly. I tried to manually destroy it before I save the form, but wasn't able to call it. The weird thing is, it works sometimes, but not others. I'm on Chrome, so that may be screwing with things, but the same thing happens in Firefox.


How can I properly destroy the CKeditor so that it always sends the textarea data in POST. Thanks!


More From » ckeditor

 Answers
12

I had this problem. What a pain.



To properly destroy the editor instance, try



if (CKEDITOR.instances.myInstanceName) CKEDITOR.instances.myInstanceName.destroy();


From the documentation here



I solved the missing content issue by assigning the contents of the editor to a hidden field prior to postback. I'm using ASP.Net, but it should work universally.



in the client-side click handler of the submit button, call



if (CKEDITOR.instances.myInstanceName)
document.getElementById('hiddenField').value = CKEDITOR.instances.getData();

[#95743] Saturday, August 28, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zoey

Total Points: 120
Total Questions: 103
Total Answers: 105

Location: Marshall Islands
Member since Mon, May 31, 2021
3 Years ago
;