This is a migrated thread and some comments may be shown as answers.

Editor change events

3 Answers 753 Views
Editor
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 19 Oct 2014, 02:14 PM
I'm using the Editor control with Angular, and would like to only enable a "Save" button if the contents of the editor has changed. Once I load stored text into the editior, I'd like the Save button disabled until the contents have actually changed. Is this possible? Seems the change only fires when focus is lost.

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 22 Oct 2014, 06:45 AM
Hello William,

Indeed you need to use the change event of the Editor and it is only triggered when you focus out the editor.

http://demos.telerik.com/kendo-ui/editor/events

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
William
Top achievements
Rank 1
answered on 30 Oct 2014, 11:33 AM
Well, we have encountered problems with this. We had an editor, and a send button, and the editor's text bound via ng-model to a scope variable. This was used to send a rich-text email if the user clicked send. If the user entered some text, then immediately clicked the send button, our code first checked to see if the bound scope variable was empty, and in many cases it was, assuming because the editor had not reacted to the focus loss yet. So, we were giving the user an error message saying that they needed to enter a message first (which they did). We worked around this by wrapping the body of the $scope.sendEmail in a $timeout() function, and only reacting after 100ms. Our preference would have been to DISABLE the send button until the user entered some text, but without a change event (without loss of focus), we could not do this. This was also a problem on other forms where we only wanted to enable the save button if the form was $dirty, but this prevented us from detecting that. 
0
Petur Subev
Telerik team
answered on 31 Oct 2014, 03:26 PM
Hello William,

A possible work-around to get notified when the editor gets focus is to attach custom event like this:

http://dojo.telerik.com/@pesho/URajo

I hope this helps.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Editor
Asked by
William
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
William
Top achievements
Rank 1
Share this question
or