Event.PreventDefault() not working in Japanese Keyboard Vue

Following code is my trapping to only accept an integer value input from user:

isNumber: function(evt) {            
        evt = (evt) ? evt : window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode;

        if((charCode >= 48 && charCode <= 57) || (charCode >= 96 && charCode <= 105) || charCode == 8 || charCode == 46 ||
        charCode ==36 || charCode ==35){  
            console.log("Im in if", charCode)                
            return true;
        } else {
            console.log("Im in else", charCode)

            //evt.stopImmediatePropagation();
            //evt.stopPropagation();
            evt.preventDefault();
            return false;

        }
    },

TEXTBOX

<ui-textbox label="initial cost"
    name="cost"
    v-validate="`numeric|decimal`"
    v-on:keydown="isNumber"
    :maxlength = "18"
    :enforceMaxlength="true"
    value = 0.00
    format="number"
></ui-textbox>

This just works well when I'm using English keyboard format. But when I switch to Japanese, this doesn't take effect. evt.preventDefault() can do the trick for this, I've added the evt.stopImmediatePropagation() and evt.stopPropagation() to try its functionality, but still I'm unlucky enough and can't make anything to work.

IT'S NOT SAME WITH YOUR LINK GIVEN. The link you've given only works in English keyboards. But when you switch to Japanese, it will not work.

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.