Skip to content Skip to sidebar Skip to footer

Ckeditor Submitting Empty Content To The Form.

I've started using CKEditor v3 few weeks ago.using it in a php project.i've been using it with jquery (using jquery adapter) and all this while using $.ajax (because can't handle f

Solution 1:

I'm running a large application with some nasty legacy code and needed something that worked across the whole app as non-intrusively as possible. In my case it wasn't feasible to listen for submits on each page individually, and even when I did I occasionally had race conditions where the submit still occurred before the click event code had a chance to do it's thing. The following seems to do the trick for me when ran after page load at a global scope:

for(var i inCKEDITOR.instances) {
  CKEDITOR.instances[i].on('blur', function() { this.updateElement(); });
}

Solution 2:

May this help

CKEDITOR.instances[content].getData()

Solution 3:

Just ran across this problem too... it seems that the best way to update all the textareas is:

for(var i in CKEDITOR.instances) CKEDITOR.instances[i].updateElement();

http://cksource.com/forums/viewtopic.php?f=11&t=15877

Solution 4:

I have actually added my own twist that works nicely as I was having trouble today with the same issue.

I used your function call, but instead do this i give my textarea the ID of ckeditor:

functionreturnToSubmit() {
$('#ckeditor').val(CKEDITOR.instances['ckeditor'].getData();
}

Solution 5:

I used this in a jquery ready event for all forms:

$('form').on('submit',function(){
  for(var i inCKEDITOR.instances) {
    CKEDITOR.instances[i].updateElement();
  }
});

Later I add another specific form submit event handler to do the actual custom submit logic for each form.

Post a Comment for "Ckeditor Submitting Empty Content To The Form."