samedi 10 janvier 2015

html5 input type = number : why is non numeric allowed to be entered into field

Possibly more a UX quesion, but...I just wasted a bit of time, trying to figure out why my html5 form field with a type of number, was allowing letters to be entered into it.


I believe I now understand what is happening (the value is never programatically available, not to javascript and not submitted to the server).


What I can't figure out is why browsers are letting me enter invalid input. Is there something I'm missing that makes it a good idea for browsers to accept abc as input for a numeric field, and then to hide that value from the programmer?


Basically should I just go ahead and bite the bullet and use on of the libraries that filter out the unacceptable input, or can I reasonably expect future versions browsers to do it for me?


Aucun commentaire:

Enregistrer un commentaire