bootstrap-timepicker icon indicating copy to clipboard operation
bootstrap-timepicker copied to clipboard

not change value in input box

Open lkashyap4th opened this issue 8 years ago • 4 comments

not change value in input box when i change in dropdown value without use button(up / down) only use manually

lkashyap4th avatar Feb 07 '17 12:02 lkashyap4th

I have the same problem too

viniciogomez89 avatar Aug 04 '17 21:08 viniciogomez89

I think I found the issue, I'm just not sure how to fix it. The problem is if you used the bootstrap-datepicker example for bootstrap-timepicker, it almost works but it fails to update the input box. Comparing code, timepicker uses something like this.$element.val(x) to set the underlying input box value whereas datepicker uses something like this.$element.find('input').val(x). I have experimented with updating the code to include the find on the set and this seems to work, but updating the get equivalent does not seem to work as intended.

doodi-v1 avatar Sep 13 '17 18:09 doodi-v1

Right now my work around is to not use the datepicker sample method.

doodi-v1 avatar Sep 13 '17 18:09 doodi-v1

I found the reason which cause the problem is keyCode always return 229 in some input method. According to W3C

If an Input Method Editor is processing key input and the event is keydown, return 229.

and I found below in source code:

widgetKeyup: function(e) {
            if (
                e.keyCode === 65 ||
                e.keyCode === 77 ||
                e.keyCode === 80 ||
                e.keyCode === 46 ||
                e.keyCode === 8 ||
                (e.keyCode >= 46 && e.keyCode <= 57) ||
                (e.keyCode >= 96 && e.keyCode <= 105)
            ) {
                this.updateFromWidgetInputs();
            }
        },

so if you use some input method like chinese or japanese, the keycode return 229 won't trigger the updateFromWidgetInputs method, and of course value in input box won't change.

My solution is quite simple, just add the keyCode 229 into the list, and it did solve the problem.

satorioh avatar May 01 '19 01:05 satorioh