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

Prevent default on timepicker input

1 Answer 286 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 02 Mar 2015, 04:13 PM
Hi,

I have a timepicker in a bootstrap modal. All works great with one exception, when I enter a time via the keyboard and hit return the event triggers and the modal is closed. I tried e.preventDefault() on the change event but this didn't work. I also tried binding a click event to the input itself and trying to preventDefault on that directly, but it is overridden. If you select a time from the dropdown via the mouse then it behaves as expected, it is only on manually typing the time that the problem occurs, which is different to the native HTML dropdown menu behaviour (latest Chrome).

Is there any way to suppress this and fire the change event?

Hope that makes sense and here is my code:

$("#reminderTimepicker").kendoTimePicker({
        animation: false,
        min: getTimelineStart(offsetMinutes),
        max: getTimelineEnd(offsetMinutes),
        interval: interval,
        change: function(e) {
            e.preventDefault();
            var selectedTime = this.value();
            $("#reminderSlider").slider("value", getSliderPointFromTime(selectedTime));
        }
    });


1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 04 Mar 2015, 10:35 AM
Hello Michael,

The Kendo UI TimePicker widget uses Html input element to allow value typing and form value posting. In general, the default input behaviors are not prevented and I suppose that Bootstrap modal listens to some of them. In order to continue with our investigation, I will ask you to send us a simple repro demo that demonstrates the implementation and the issue. Thus we will be able to review the issue and follow you up with more details.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Date/Time Pickers
Asked by
Michael
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or