What are some new features in HTML5 Forms?




One of the major benefits of the new features in HTML5 forms is the fact that it makes developing forms faster – so developers can save time writing tedious code. There are two new HTTP types for the form action – update and delete – that go along with GET and POST that are the currently available options for submitting forms. But the best new features for developers are the new form input types which actually have built in error validation and even special user interfaces.

The built in error validation for certain form input types will eventually save developers a lot of Javascript validation once everyone has an HTML5 browser. But, until that day when everyone has an HTML5 browser, developers will still need to have the appropriate Javascript validation to support older browsers.

There is actually a methodology called polyfilling which allows developers to just write their code according to the HTML5 Standard, but older browsers are helped through the use of Javascript.

Examples of new features added to HTML5 Forms

As an example, some of the new form input types that have been added include the email input type, URL input type, and the date input type. If no input type is specified, or even if an unknown type was specified, then the HTML 4 standard says that browsers should assume that the <input type=text> should be used instead. This means that for older, legacy browsers which don’t support HTML5 (but do support HTML 4), and therefore see the new input types as “unknown”, then those older browsers will fall back to the default of letting users enter data in a plain text form field. But, if you want the older browsers to behave the same way that the newer browsers behave, then you can use the method called polyfilling – which uses Javascript – to have the older browsers behave like the newer HTML5 compliant browsers.

The HTML5 specification doesn’t say how browsers should report errors or display input types

Because of the fact that the HTML5 specification doesn’t specify how errors in form validation should be handled, those errors will look different depending on the browser. And, how the form input types are displayed will also depend on the browser.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.