views:

57

answers:

2

I have a simple webform targeted for Opera Mini and Opera Mobile. I'm using just a HTML input element.

Now I would like to restrict the element to only have integer numbers. Is there a way to enforce this in this browser (possible even that the phone will have it's number mode on when entering the form)?

And if I wanted to allow floats, is something possible then?

+1  A: 

You should be able to use the "number" input type, it's part of the HTML5 spec. I'm unsure if Opera will automatically display the numeric keypad but the iphone at least does...

dsas
+1  A: 

In XHTML Basic, you can use inputmode="digits" on your <input> tags to accomplish this. It ought to be more widely supported on mobile browsers that HTML5 mechanisms.

Sean Owen