Chapter 8. Forms
This chapter covers
- An introduction to Zend_Form
- A step-by-step demonstration using Zend_Form
- Filtering and validating form data
- Form markup and styling
Anyone who has winced at the things toddlers unwittingly thrust into their mouths will understand the anxiety developers feel when building forms. Any opening into the application raises questions of security and stability. Just as a biological body must have its protective measures, so must our forms.
Having said that, protecting our forms isn’t the only thing we need to take into consideration; they must also be usable. A form’s usability is difficult to determine without a reasonable period of testing, which actually means that there is a hidden requirement of form design—flexibility. Discovered insecurities, usability issues, updates, and additions to the underlying architecture may all require forms to change. A flexible system allows these changes to be made promptly and inexpensively.
Zend Framework has many options for the design of forms, from its MVC architecture to its data filters and validators. Previous chapters have demonstrated various approaches to building forms; in this chapter we’ll look at a component designed specifically for the job, Zend_Form.