HTML5 Development: Form & Keyboard Events

By Curtis Dicken

http://www.htmlgoodies.com/html5/tutorials/HTML5-Development-Form--Keyboard-Events-3885651.htm (Back to article)

Introduction

Recently we have covered some of the major event categories for HTML5. In this installment we'll take a look at the "miscellaneous" categories that we have not yet covered. We'll see what HTML5 offers in new form events as well as most of the form and keyboard events developers have become accustomed to in HTML4. We'll also discuss one notable event that didn't make the transition from HTML4 to HTML5.

Form Events

The Form events in HTML4 were a great way to quickly respond to user interaction with a form. They make things like instantly giving validation feedback to a user possible. With HTML5 those events have been almost doubled from 6 to 10. This includes one of the few events that were actually dropped and not deprecated from HTML4. Below are the form events of HTML5.

Keyboard Events

There are only a handful of keyboard events in HTML. Though they can be very useful, the scope of their useful applications is fairly narrow. In most circumstances developers don't need to perform an action each time the user presses a key on the keyboard. Therefore, HTML5 has not introduced any new keyboard events and they would probably be hard pressed to even come up with a new event that makes sense anyway. Below are the only keyboard events that are found in both HTML4 and HTML5.

Conclusion

In HTML5 there have been some much welcome improvements in how forms are handled. The new events for forms make validation much easier and more robust. If you have ever done much with form validation you will welcome the changes. Happy coding!