Dec 042012

An important gotcha of some HTML5 semantic web stuff:

An input of type=”number” attribute on an input and discovered that Safari 5 and IE would re-format the number the way you learned to in grade school if your number is greater than 999 (i.e., adding commas between thousands). Yes, the commas actually get submitted when you submit your form, making your back-end receive those thousand-separated numbers (which is probably not what you want).

<input type=”number”></input>

If that’s not your desired effect, stick to text and use a pattern attribute (along with required) to validate with regexp. Something like this does the trick:

<input type=”text” required= pattern=”[0-9]*”>