Introduction

One of the key issues with HTML forms is form state maintainence. This is whereby the form is redisplayed to the user if some required fields are missing. However, information already entered in the form must be displayed as-is and not be lost (to prevent the user from having to type all that again).

Form state maintainence is not an issue when AJAX or client side javascript is used to validate form data (including required fields). AJAX can be used to validate a given value on the server side (by invoking server-side code) and this mitigates some of the client hackability issues.

However, for simple server-driven forms, form-state maintainence is essential.

The Molly Form API

Forms come in 2 varieties: Forms and Simpleforms. These are 2 seperate ways and unconnected to each other. Even though I (the author), spent much more time Forms encapsulate HTML form elements as Java objects. You can dynamically create a server side form object containing various forms fields. These can then be rendered to the browser (a form knows how to render itself).

The main benefit to using the Forms API is automatic form-state maintainence.