5 ms·
Worst of those I encounter regularly is US sites trying to constrain your input to numbers only on certain fields. Not "letting you input anything and marking i
by khepin 5y ago
Worst of those I encounter regularly is US sites trying to constrain your input to numbers only on certain fields.
Not "letting you input anything and marking it invalid if you put something other than a number", but listening to which key is pressed to allow the typing or not.
On French keyboards, typing a number requires the use of the SHIFT key. So I regularly need to change my keyboard layout just to type a couple numbers in a form field because someone thought they'd be smart...
- fuzzy2 5y agoOh yeah I had that recently in a project (IE support required, so no type=number). When you try this, you will eventually find that you use so many keys during normal operation that a whitelist just isn't feasible. Left, right, tab, Home, End, Ctrl+C/V, Shift+Ins, …
- account42 5y agoThrowing away keys is never the right thing to do anyway. If the user typed 5y8 you don't know if they meant 58 or if the y was meant to be a 6 or 7 so the best thing to do is to have the field contain the full user input and higlight the input as invalid rather than silently guessing what the user meant.
- Sammi 5y agoValidate, don't parse ;p