Form Engine
How to build Forms in phpHtmlLib
by Culley Harrelson
by Walter A. Boring IV
by Suren Markossian
© October 2007, Walter A. Boring IV
(phpHtmlLib 3.0.1)
Table of Contents
Overview
phpHtmlLib includes a mature html forms engine that handles, among
other things, rendering and validation. There are a number of example
forms on the phpHtmlLib web site and you are highly recommended to
review these examples. The intention of this tutorial is to explain
the phpHtmlLib forms engine without extensively using language specific
to phpHtmlLib. If you are looking for detailed information please see
the relavant sections of the api reference.
Features
- FormProcessor manages the state of processing a form. You just have to build
the FormContent child then pass that into the FormProcessor, and everything is taken
care of.
- FormContent - Parent class that contains the APIs for declaring:
- FormElements that are in the form.
- How to initialize the FormElements (for example, editing existing data)
- How to place/layout the form fields
- Do any backend validation such as ensuring that you aren't creating a duplicate entry
in the database.
- processing the real form action after ALL validation has been completed.
- StandardFormContent - contains all the functionality as the Formcontent, but provides a
'standard' look and feel for layout of elements, as well as showing a confirmation mode.
- over 40 pre defined FormElements, some of which are complex elements that contain multiple
elements.
- Build a form quickly and easily from over 40 pre-defined form elements.
- Data validation is handled automatically depending on the type of form
element selected.
- Data validation against exteral sources such as a database is performed
when the form element validation passes. For example, if you have
included a {@see FENumber} form element in your form, the form validator will
first require the user to enter a valid number in this field. If you
also need to compare the number entered with a number extracted from
your database the form validator will perform whatever processing
needed for this look up after the basic element validation is complete.
- When the data validation process is unsuccessful do to user error the
labels of the form elements involved in the problem are highlighted.
Additionaly a complete description of all errors is displayed at the
top of the form. This error display defaults to a two column table
listing the field name and the error that occurred. If more than one
error occurs for a given field there will be more than one row for that
field. The error display is completely customizable and can be
rendered however you like.
Blank Form Template
laundry list of all you can do with the forms
Form Handling
Overview of FormContent basically. How much do we want to talk about FormProcessor? FormElements?
Placing Fields on the Form
element selection handles front end validation. Do we want to detail
elements here or put them in another section? Just cover the most
common elements?
Default Values for Form Elements
what is going on here
Form Layout
what is going on here
Backend Form Validation
what is going on here
Processing Form Results
what is going on here
Customizing
Various customizations
Form Confirmation Display
How to build a customized confirmation display
Form Errors Display
How to build a customized error display
Multiple forms on 1 page
This section will discuss what is necessary for multiple forms on the same page.
Documentation generated on Thu, 11 Oct 2007 12:05:14 -0700 by phpDocumentor 1.4.0