input type=number not possible to insert negative numbers on mobile phone input type=number not possible to insert negative numbers on mobile phone ruby-on-rails ruby-on-rails

input type=number not possible to insert negative numbers on mobile phone


The issue is specific to Samsung custom keyboard - hooray to vendors who think they're smarter than everyone. Here is another example of this issue at work


In short, there's no way to make the minus sign show up on Samsung Android numeric inputs. Here are a few workarounds I've run across:

1) Google Keyboard

The user can install a different keyboard (like Google Keyboard). Obviously not ideal to have people install something though.

enter image description here

2) Negate Button

As @Cris already suggested, add a button which will negate the value. If you've got the screen real estate then great.

3) Double Dot Trick

We ended up with a fairly ugly workaround where the user can press . twice and it will negate the number. Totally non-discoverable but an extra button wasn't an option for us.

https://gist.github.com/bendytree/936f6b9b4c0e10138b7e9158b5fd05d9


Make an extra input field. A "sign" checkbox, selecting natural or negative integers.

Then hook the onchange event of the checkbox so that you update the number view to reflect the chosen sign.