Confirm dialog in change event for combobox

4 posts, 0 answers
  1. Karel
    Karel avatar
    2 posts
    Member since:
    Aug 2017

    Posted 25 Jan Link to this post

    Hello,
    I have problem with the confirm dialog in change event for combobox.

    Link: https://dojo.telerik.com/UhEpeZod/6
     
    The problem appears when I put any new text into the combobox and press enter. Why is the done function executed first and no confirm dialog shows? Is it a bug?

     Thank you and kind regards
  2. Dimitar
    Admin
    Dimitar avatar
    683 posts

    Posted 29 Jan Link to this post

    Hello Karel,

    The ComboBox keydown event handler triggers the click on the currently focused element which is the Confirm's "OK" button in this scenario. Thus, to resolve the issue I would suggest simply to wrap it in a timeout as follows:
    function onChange() {
      setTimeout(function() {
        kendo.confirm("Are you sure?")
          .done( function() {
            kendo.alert("done");
          })
         .fail(function() {
           kendo.alert("fail");
         }); 
      });                              
    }

    Here is an updated Dojo example.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Karel
    Karel avatar
    2 posts
    Member since:
    Aug 2017

    Posted 29 Jan Link to this post

    Hello,

    Thank you for your answer. The suggested solution deals with my problem only partially. Now the confirm dialog is called twice.

    Steps to reproduce:

    1. Put any text into the combox, press enter or tab and I confirm the confirm dialog [Until now is everything ok]

    2. Continue writing text in the combobox (do not remove existing text before), press enter or tab and now appears the confirm dialog twice.

    How should this be solved?

    Another problem is that if I do the two mentioned steps and confirm the confirm dialog with enter, then no "done" alert shows. Is there any solution to this as well?

     

    Thank you and kind regards

  4. Dimitar
    Admin
    Dimitar avatar
    683 posts

    Posted 30 Jan Link to this post

    Hello Karel,

    I have investigated the described scenario and you are indeed correct that the Confirm is displayed twice. I have also managed to pin down the exact cause of the issue - the ComboBox is calling the change event a second time. This is related to a previous fix for the ComboBox widget. I have reopened the related GitHub issue and you can start tracking the progress that we make on it from item #4496.

    Regards,
    Dimitar
    Progress Telerik
    Get quickly onboard and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top