JavaScript Form Validation, the Aspect-Oriented Way
Did you know you can apply Aspect-Oriented Programming to client-side JavaScript form validation? Read on to find out how.
by Kyle Gabhart
June 15, 2006
y now you likely have worked with, or at least experimented with, cross-cutting concerns, a core element of Aspect-Oriented Programming (AOP). AOP is an excellent and very compelling approach for traditional software development, but you may be surprised to learn that it can also be applied to client-side JavaScript form validation, thanks to Dan G. Switzer's development of the qForms JavaScript API.
This 10-Minute Solution examines the qForms JavaScript API, highlighting the ability to apply JS form validation logic to the forms of a page in an aspect-oriented way. With qForms, you can include a single JS library in a page, and then add a single block of <script> code that defines the validation rules to the bottom. In doing so, you inject validation into a form without the typical messy onClick/onSubmit garbage.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!