Prevent default on timepicker input

2 posts, 0 answers
  1. Michael
    Michael avatar
    9 posts
    Member since:
    Feb 2015

    Posted 02 Mar 2015 Link to this post

    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));
            }
        });


  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 04 Mar 2015 Link to this post

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