andr-04 / inputmask-multi

http://andr-04.github.com/inputmask-multi/
253 stars 106 forks source link

Can't enter uppercase letters #8

Closed annames closed 10 years ago

annames commented 10 years ago

Hello,

I'm using your plugin with inputmask 3.0.55 on a form that allows grade entry for tests in a class. I have fields that must allow either a timed score (such as MM:SS format) or an "X" to indicate that a particular student did not complete the test. I am replacing long-standing code that did not work with IE 11 or Chrome, so there is a lot of data in the wild and many existing users who are familiar with this functionality and so I can't change it; I must allow a time (in a variety of user-selected formats) or an upper- or lowercase X.

This all works fine, and having multiple masks is very cool (thanks!), except that a couple of lines of event handling code in inputmask-multi are preventing me from entering uppercase letters.

In the mask function, lines 195 and 198 cause a "return true" if e.shiftKey is true... but that will be true even if the shift key is being held down in order to uppercase a letter. I changed that section of code to the following:

                    if (e.ctrlKey || k == opts.keyCode.SHIFT || e.altKey) {
                        return true;
                    }
                } else if (e.type == "keypress" && (e.ctrlKey || k == opts.keyCode.SHIFT || e.altKey)) {
                    return true;
                }

and it all works great. Without that change, the code exited before ever calling the keypressEvent function in inputmask, so my letter mask (with /[xX]/ validator) always failed for uppercase X (but worked fine for lowercase x).

Is this a reasonable change to make? Should the other key references here also use the opts.keyCode values or are they best left as they are?

Thanks, Ann

RobinHerbots commented 10 years ago

@annames ,

This is an issue for the jquery.inputmask. The file jquery.inputmask-multi.js has nothing todo with this project. This project only supports the earlier inputmask.

Can you open the same issue at https://github.com/RobinHerbots/jquery.inputmask

best regards, Robin

annames commented 10 years ago

Oh sure - sorry about that. I just posted it over there: https://github.com/RobinHerbots/jquery.inputmask/issues/574 .