IE doesn't update view model when enter key pressed

5 posts, 0 answers
  1. Roger
    Roger avatar
    14 posts
    Member since:
    Aug 2012

    Posted 10 Oct 2012 Link to this post

    If you have an input element with a binding to some property in a view model object.
    In Chrome, if you are in the field and press enter, the change event fires on the view model and the new value is set.
    In IE (9 for me)  the event does not fire until you blur the input element.
    I am working around it by adding a keypress event and manually doing 
       self.viewModel.set(valuePath, $(this).attr('value'));
    when the enter key is pressed.
    But its clunky and should not be necessary.

    Is there some way to force IE to update the view model binding when the enter key is pressed?

    Thanks.
  2. Roger
    Roger avatar
    14 posts
    Member since:
    Aug 2012

    Posted 17 Oct 2012 Link to this post

    Anybody....?
  3. Kendo UI is VS 2017 Ready
  4. Paul
    Paul avatar
    42 posts
    Member since:
    Aug 2005

    Posted 07 Oct 2015 Link to this post

    This is still a problem, is there any better solution to this than the above?
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 12 Oct 2015 Link to this post

    Hello Paul,

    The behavior you are observing is no related to Kendo UI, but it is specific to how browsers triggers change event. You may use this test page to try it for yourself - open the page in Chrome and IE9 , type something and press Enter. 
    As you may know, in order to track changes the MVVM value binding listens on the change event of the input element, thus when this event is not raised, the MVVM is not notified for the updated value. You could consider using the data-value-update="keyup", as demonstrated in this online demo, to instruct the MVVM to update the model when user types. Or use the workaround which is mentioned in this forum post.

    Regards,
    Rosen
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Paul
    Paul avatar
    42 posts
    Member since:
    Aug 2005

    Posted 12 Oct 2015 Link to this post

    Hello Rosen, thank you for the reply. I did indeed use the solution with the keyup event as suggested after some judicious Googling.
Back to Top
Kendo UI is VS 2017 Ready