Pete Hodgson Pete Hodgson is a consultant at Thought Works, where he's spent the last few years helping teams become awesome at sustainable delivery of high-quality software.He's particularly passionate about web-based mobile, ruby, agile, functional approaches to software, and beer.For a more detailed introduction to HTML5 form validation you can find some great articles linked under References below.In this article we intend to present only a number of simple examples to get you started, covering the basic form elements.Let us look at an example of a simple form As you can see, the first button simply resets all the fields using reset() as described earlier.
Here you can read more about styling of the form and error dialogs.
The simplest change you can make to your forms is to mark a text input field as 'required': This informs the (HTML5-aware) web browser that the field is to be considered mandatory.
Different browsers may mark the input box in some way (Firefox 4 Beta adds a red box-shadow by default), display a warning (Opera) or even prevent the form from being submitted if this field has no value.
All of this code will be executed by the runtime synchronously, in a single turn through the event loop .
Another way to think about this is that method calls which operate synchronously are a special case of the more general asynchronous case.