Editor change events

4 posts, 0 answers
  1. William
    William avatar
    2 posts
    Member since:
    Nov 2013

    Posted 19 Oct 2014 Link to this post

    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.
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 22 Oct 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. William
    William avatar
    2 posts
    Member since:
    Nov 2013

    Posted 30 Oct 2014 in reply to Petur Subev Link to this post

    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. 
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 31 Oct 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready