I have an application that supports multiple forms per page, and some of these forms may have CKEditor textareas with the same name. For example:
<form id="form1" action="demo_form.php"> <div><textarea class="ckeditor" rows="10" cols="100" name=1></textarea></div> </form> <form id="form2" action="demo_form.php"> <div><textarea class="ckeditor" rows="10" cols="100" name=1></textarea></div> </form>
If I try to just use AJAX to submit a form, the textarea is empty on my form. The solution I found says I need to run updateElement() on each instance.
for( instance in CKEDITOR.instances ) { CKEDITOR.instances[instance].updateElement(); }
The problem is that I only have one instance in CKEDITOR.instances, when there should be 2, and the code only updates the last form. I'm pretty sure the form HTML segment is completely valid. It at least passes the W3 HTML validation service. A normal HTML submit will still work fine here. It's just the AJAX and serialize that I'm having trouble with.
Should I be doing something else to create/update my forms w/ CKEditor boxes or did I find a bug in the first hour of using CKEditor? I've spent hours trying to sort this out with no luck, which is MUCH longer than it took me to integrate CKEditor into my project. The only version I have used is 4.3.2, so I cannot say if it ever worked. It would also be nice if I could just update the CKEditor for a particular form instead of firing this for every form, but I would be satisfied if I could get it to just update everything every time, even if I'm resing the same names in different forms.
I solved my issue by
I solved my issue by including id attributes in my textarea tags.
Now it uses the textarea's id instead of the non-unique name.