So this works in Chrome/FireFox on Windows and Linux, but IE8 on Win7/WinXP fails to behave as expected.
I'm using CKEditor with the jQuery adapter. I set up the editor initially like so:
$(document).ready( function(){
CKEDITOR.config.height = 400;
// i.e. <textarea id="msgtext"></textarea>
$('#msgtext').ckeditor();
} );
I then call a function which loads the editor up with some data from a passed parameter:
function loadData(paramValue) {
$('#msgtext').val(paramValue);
}
This works everywhere I've tested, as you might expect.
I want the user to be able to make edits to the data gotten by loadData()
and then submit it. This is where I see the issue with IE.
When the user clicks to submit, I make an AJAX call through a function doCheck()
, and then in it's callback function doSend()
I actually grab the text from the CKEditor. My intention is to pick up whatever the user has input since it was initially loaded, i.e. any edits.
So when the user clicks submit
doCheck(someId, doSend);
happens, and after the response from the doCheck()
AJAX call returns, doSend()
fires, where I'm attempting to pick up the edits from CKEditor:
doSend() {
var text = $('#msgtext').val();
// ... send 'text' via another AJAX call ...
}
This works exactly as expected in everything but IE8. That is, the edits are returned by val()
. In IE8, I only get what was added initially during loadData()
. I've tried doing things like updateElement()
, and the behavior is still the same. This seems like pretty straightforward usage to me, but maybe I'm missing something.
Update:
It turns out this wasn't a problem with CKEditor after all. Instead, it was a dumb, but kind of subtle bug in my own code.
I omitted, for brevity, but also because I didn't think it could be the issue, that I prompt the user for a passphrase, which calls doCheck()
when submitted. At some point earlier in development I had added a onKeyPress
handler to the <button>
element (I can't even remember why now), and forgotten to remove it:
<button
onKeyPress="{if (event.keyCode==13) doCheck()}"
onClick="doCheck();" >Submit</button>
So effectively things were getting submitted twice. When I fixed the offending code, it began working everywhere, even IE.