in Frontend Tech, News

html5 forms

I checked html 5 form spec at w3.org website and found quite interesting form types. Those are:

  • search
  • tel
  • url
  • datetime
  • date
  • month
  • week
  • time
  • datetime-local
  • number
  • range
  • color


As you can see there are so many types in HTML 5 specs. And validation for the specific data type MUST be done on the browser side according to the w3.org doc. So FE engineers do not have to implement own validation for the form fields any more.

However, even if client side validation is done by the browser, server-side data validation MUST be accompanied. Using javascript, hackers can change the type attribute anyway they want and bypass client validation by setting them to “TEXT”.

There are also some new attributes introduced in the HTML 5 spec. Those are:

  • autocomplete
  • pattern
  • placeholder
  • valueAsDate
  • valueAsNumber
  • list