#11602 closed Bug (invalid)
onchange event does not fire for CKEditor textarea input elements.
Reported by: | Daryl H. | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
My application uses onchange="fldchanged();". It does not fire. Tested on IE and FireFox.
Attachments (1)
Change History (7)
Changed 11 years ago by
Attachment: | onchange-example.html added |
---|
comment:1 Changed 11 years ago by
Keywords: | onchange added |
---|
comment:2 Changed 11 years ago by
Keywords: | onchange removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Version: | 4.3 |
CKEditor does not use textarea for editing. The textarea is replaced by CKEditor. Therefore, doing anything with that replaced textarea won't give any results. The only thing that is done with textarea is updating it with editor's data before submitting form, so the data is submitted with the form.
If you want to listen on changes in CKEditor, then use this event http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-change
comment:3 Changed 11 years ago by
Could't you fire the change event manually upon replace? ie,
if (savedtextarea.onchange) savedtextarea.onchange();
comment:4 Changed 11 years ago by
We don't find this justified. CKEditor is not trying to mimic textarea. It uses it only for data source.
comment:5 Changed 11 years ago by
Not to sound too pedantic, but shouldn't you be striving to emulate the entire functionality of the component you are trying to replace?
I looked at the link you provided, but it did not show examples on how to hook up the event. It would help if you could please provide a snipit of code to facilitate this. thanks.
comment:6 Changed 11 years ago by
CKEditor is not trying to replace anything. Developer is doing that using CKEditor. That developer has full control over his website and can add a listener to the editor instance instead of adding it to textarea which, as I wrote earlier, is only a source of data loaded to CKEditor and submitted with a form. Moreover, there are hundreds of events, methods and properties on textarea or related to it. Editor cannot emulate most of them, so it's not even trying to do that.
This is more or less how emulation would have to look like:
editor.on( 'blur', function() { if ( editor.checkDirty() ) { editor.updateElement(); textarea.onchange(); editor.resetDirty(); } } );
test to see if onchange event fires