Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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:


My application uses onchange="fldchanged();". It does not fire. Tested on IE and FireFox.

Attachments (1)

onchange-example.html (7.2 KB) - added by Daryl H. 10 years ago.
test to see if onchange event fires

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Daryl H.

Attachment: onchange-example.html added

test to see if onchange event fires

comment:1 Changed 10 years ago by Daryl H.

Keywords: onchange added

comment:2 Changed 10 years ago by Piotrek Koszuliński

Keywords: onchange removed
Resolution: invalid
Status: newclosed
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!/api/CKEDITOR.editor-event-change

comment:3 Changed 10 years ago by Daryl H.

Could't you fire the change event manually upon replace? ie,

if (savedtextarea.onchange)

Last edited 10 years ago by Daryl H. (previous) (diff)

comment:4 Changed 10 years ago by Piotrek Koszuliński

We don't find this justified. CKEditor is not trying to mimic textarea. It uses it only for data source.

comment:5 Changed 10 years ago by Daryl H.

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 10 years ago by Piotrek Koszuliński

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() ) {
} );
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy