Ckeditor Submitting Empty Content To The Form.
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();
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."