by tobr · 11y ago · 0 comments
As far as I understand, there's no way to feature detect this stuff. Why not just use text input? Because on iOS, `type="number"` is the only way to get a keyboard with both digits and a decimal separator. So, browser sniffing it is...
[1] http://www.statisticalconsultants.co.nz/blog/how-the-world-s...
What I don't understand is why this weird validation behavior only exists for <input type="number"> and not for other input types that have built-in validation rules such as <input type="email"> and <input type="url">. Imagine an <input type="email"> reporting that its value is an empty string if the user didn't enter a completely valid email address.
[1] https://docs.angularjs.org/api/ng/input/input%5Bemail%5D
"<blink> !_joe!jim%foo_jay\@sus/\$ch=rist;`rm -fr /`"@example.com
Perfectly fine according to RFC 822.
RFC 2822 is better and rejects that, so things have changed for the better, and theoretically could change again (though I wouldn't bet money on it).
RFC 2822 still accepts:
"joe!jim%foo_jaysus/cee=rist;`rm -fr /`"@example.com
We must accept there's no reliable and correct way to help with many classes of actual user errors on input even if the world's existing SMTP servers can actually choke on valid RFC 822/RFC 2822 addresses.
Actually, this isn't true. It will also show the number keyboard on a normal type=text input if you add a pattern="[0-9]*" property.
EDIT: Sorry, misread your comment; you wanted the decimal separator too. I believe that might be impossible to get without type=number.
Really? How would you enter a street address into a form consisting of just text inputs?