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

Confirm dialog in change event for combobox

3 Answers 511 Views
Dialog
This is a migrated thread and some comments may be shown as answers.
Karel
Top achievements
Rank 1
Karel asked on 25 Jan 2019, 12:19 PM
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

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 29 Jan 2019, 09:06 AM
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.
0
Karel
Top achievements
Rank 1
answered on 29 Jan 2019, 12:49 PM

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

0
Dimitar
Telerik team
answered on 30 Jan 2019, 09:41 AM
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.
Tags
Dialog
Asked by
Karel
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Karel
Top achievements
Rank 1
Share this question
or