David Sklar, Software Architect, Ning, Inc.
Track: PHP
Date: Wednesday, July 28
Time: 11:35am - 12:20pm
Location: Salon D
TrackBack
Displaying and processing HTML forms correctly in PHP can be a headache. You need to pay attention to printing context-sensitive error messages, preserving default values, properly encoding user input, and validating many different kinds of fields. The PEAR package HTML_QuickForm removes that headache. It's flexible architecture makes it a breeze to programmatically construct, display, and validate HTML forms of any size.
This session shows you how to harness the power of HTML_QuickForm in your PHP programs. It explains:
Working with different element types
Validating input with built-in and custom rules
Processing submitted form data, including file uploads
Customizing form display with the default renderer
Customizing form display with an external template engine
With HTML_QuickForm, a form is a logical collection of typed form elements instead of an undifferentiated blob of HTML. This makes it simple to decide dynamically what elements go in a particular form, to assign appropriate error messages and validation rules to individual elements, and to control the form layout in a systematic way across an entire site.
Instead of relying on ad-hoc functions and methods for tasks like checking whether required form fields are filled in, preserving a default value in a dropdown menu, or adjusting the style attributes of form elements, use HTML_QuickForm for a simple, structured approach to form management.
Download presentation file