I would assume that this is merely a hint to the browser to show you a numeric keyboard.
The standard says that the empty string is a valid value. So the user agent ("browser") will send it always.
| [reply] |
In a browser that does not understand HTML5, <input type="number"> would be handled like <input type="any nonsense you can think of">, i.e. like <input type="text">.
Anyway, one should never rely on the client to do input validation. Input validation always has to be done on the server. Simply because any client side input validation can be bypassed, with nearly zero effort.
Client-side validation is not useless, but it is only an optional add-on to the required server-side validation. Client-side validation can be used to reduce the server load by preventing the form submit until all input is valid. It can mark wrong input while typing. It can highlight fields lacking required information. It can show usage hints in case of wrong input.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] [d/l] [select] |