RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.36k stars 2.17k forks source link

Masking not working with Google Gboard keyboard #1972

Open parthakbari opened 5 years ago

parthakbari commented 5 years ago

Thanks for the Maksing lib. you did great work.

Device info :
Redmi 3S Prime Android Version 6.0.1MMB29M Keyboard version : 6.6

We are applied masking for vehicle Registration number but its not working with Gboard keyboard Chrome browser. Note: its working on desktop, android normal keyboard only facing issue with Gboard keyboard Chrome Browser.

When i turnoff the Gboard text correction section when it's working fine.

Implementation below

regno = [ { "mask": "##-$$-#-$" }, { "mask": "##-$$-#-$$" }, { "mask": "##-$$-#-$$$" }, { "mask": "##-$$-#-$$$$" }, { "mask": "##-$$-##-$" }, { "mask": "##-$$-##-$$" }, { "mask": "##-$$-##-$$$" }, { "mask": "##-$$-##-$$$$" }, { "mask": "##-$$-###-$" }, { "mask": "##-$$-###-$$" }, { "mask": "##-$$-###-$$$" }, { "mask": "##-$$-###-$$$$" }, { "mask": "##-$#-$" }, { "mask": "##-$#-$$" }, { "mask": "##-$#-$$$" }, { "mask": "##-$#-$$$$" }, { "mask": "##-$#-#-$" }, { "mask": "##-$#-#-$$" }, { "mask": "##-$#-#-$$$" }, { "mask": "##-$#-#-$$$$" }, { "mask": "##-$#-##-$" }, { "mask": "##-$#-##-$$" }, { "mask": "##-$#-##-$$$" }, { "mask": "##-$#-##-$$$$" }, { "mask": "##-$$-$" }, { "mask": "##-$$-$$" }, { "mask": "##-$$-$$$" }, { "mask": "##-$$-$$$$" }, { "mask": "###" }, { "mask": "###---$$$$" } ];

We have created on generic function BindMasking.

BindMasking({ inputobject: '#RegistrationNumber', mask: regno, greedy: false, definitions: { '#': { validator: "[a-zA-Z]|[NEW]{3}|[new]{3}", cardinality: 1 }, '$': { validator: "[0-9]", cardinality: 1 } } });

`function BindMasking(options) { var mask = options.mask; var textControl = options.inputobject; var greedy = options.greedy; var definitions = options.definitions; var autoUnmask = options.autoUnmask == undefined ? false : options.autoUnmask; var placeholder = options.placeholder == undefined ? " " : options.placeholder;

$(textControl).inputmask({
    mask: mask,
    greedy: greedy, placeholder: placeholder, autoUnmask: autoUnmask,
    definitions: definitions,
    clearMaskOnLostFocus: true, keepStatic: false
    //onKeyDown: function (event) {
    //    //disable right, left, up and down arrow
    //    if(event.keyCode == 39 || event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 40) {
    //        event.preventDefault();
    //    }
    //}
});

}`

Are we missing other option which may help when mobile device come.

ezgif-2-83f04991f4

I am using this two JavaScript file on page. image image

Let me know if you need more information.

RobinHerbots commented 5 years ago

Try the disablePredictiveText options. See readme

Op vr 17 aug. 2018 14:53 schreef Parth Akbari notifications@github.com:

Thanks for the Maksing lib. you did great work.

Device info : Redmi 3S Prime Android Version 6.0.1MMB29M Keyboard version : 6.6

We are applied masking for vehicle Registration number but its not working with Gboard keyboard Chrome browser. Note: its working on desktop, android normal keyboard only facing issue with Gboard keyboard Chrome Browser.

When i turnoff the Gboard text correction section when it's working fine.

Implementation below

regno = [ { "mask": "##-$$-#-$" }, { "mask": "##-$$-#-$$" }, { "mask": "##-$$-#-$$$" }, { "mask": "##-$$-#-$$$$" }, { "mask": "##-$$-##-$" }, { "mask": "##-$$-##-$$" }, { "mask": "##-$$-##-$$$" }, { "mask": "##-$$-##-$$$$" }, { "mask": "##-$$-###-$" }, { "mask": "##-$$-###-$$" }, { "mask": "##-$$-###-$$$" }, { "mask": "##-$$-###-$$$$" }, { "mask": "##-$#-$" }, { "mask": "##-$#-$$" }, { "mask": "##-$#-$$$" }, { "mask": "##-$#-$$$$" }, { "mask": "##-$#-#-$" }, { "mask": "##-$#-#-$$" }, { "mask": "##-$#-#-$$$" }, { "mask": "##-$#-#-$$$$" }, { "mask": "##-$#-##-$" }, { "mask": "##-$#-##-$$" }, { "mask": "##-$#-##-$$$" }, { "mask": "##-$#-##-$$$$" }, { "mask": "##-$$-$" }, { "mask": "##-$$-$$" }, { "mask": "##-$$-$$$" }, { "mask": "##-$$-$$$$" }, { "mask": "###" }, { "mask": "###---$$$$" } ];

We have created on generic function BindMasking.

BindMasking({ inputobject: '#RegistrationNumber', mask: regno, greedy: false, definitions: { '#': { validator: "[a-zA-Z]|[NEW]{3}|[new]{3}", cardinality: 1 }, '$': { validator: "[0-9]", cardinality: 1 } } });

`function BindMasking(options) { var mask = options.mask; var textControl = options.inputobject; var greedy = options.greedy; var definitions = options.definitions; var autoUnmask = options.autoUnmask == undefined ? false : options.autoUnmask; var placeholder = options.placeholder == undefined ? " " : options.placeholder;

$(textControl).inputmask({ mask: mask, greedy: greedy, placeholder: placeholder, autoUnmask: autoUnmask, definitions: definitions, clearMaskOnLostFocus: true, keepStatic: false //onKeyDown: function (event) { // //disable right, left, up and down arrow // if(event.keyCode == 39 || event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 40) { // event.preventDefault(); // } //} });

}`

Are we missing other option which may help when mobile device come.

[image: ezgif-2-83f04991f4] https://user-images.githubusercontent.com/3718529/44266198-4479a280-a247-11e8-92c3-278d6b3830e6.gif

I am using this two JavaScript file on page. [image: image] https://user-images.githubusercontent.com/3718529/44267079-7c361980-a24a-11e8-8aa6-7ebc6dca5a69.png [image: image] https://user-images.githubusercontent.com/3718529/44267089-89eb9f00-a24a-11e8-827c-bbdab7a96170.png

Let me know if you need more information.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RobinHerbots/Inputmask/issues/1972, or mute the thread https://github.com/notifications/unsubscribe-auth/AATb7-7vFdLhjtPJSVQrjJZwFhdOyehAks5uRrzGgaJpZM4WBg2Y .

parthakbari commented 5 years ago

@RobinHerbots , thanks for the reply. disablePredictiveText option did not work do you have any other solution.

We can change the input type text to password because it's user readable text.

yunyunzai commented 4 years ago

try this: $(textControl).on("keyup", function(e){this.blur(); this.focus();});