The Form module


The TIP_Form module provides a generic way to build forms using the TiP framework. It is heavely based on the HTML_QuickForm PEAR package.

The form is automatically generated by scanning the field structure of the TIP_Data object.

Despite of the common TiP way to manage things (that is concept separation: style on the left and logic on the right), the form generation does not follow religiously this way. The HTML_QuickForm package generates HTML, and so the logic (PHP) generates style (HTML). Anyway, a number of parameters can be configured to allow a decent level of form customization.

How to generate a form

Usually the form is automatically created by some common action, such as edit and add, that call the TIP_Content::form() method. In some situations, however, you can force a form generation by using special tags, such as the add tag in the TIP_Comments module.

How to customize a form

A lot of options can be configured by using the field comments availables on the database server. Simply use phpMyAdmin (or anyway you fill comfortable with) to put some parameter in the comments of a field. Here is a sample string to put in the comments:

widget=picture|widget_args=autoresize|rules=maxpicturesize(80 80)

This parameters should be specified in the form parameter1=value1|parameter2=value2|.... This means the parameter names and values cannot contain the | character.

Technical details

Whenever TIP_Form::run() method is called on a TIP_Form instance, the following steps are performed:

Althought this list representation seems quite simple, the form generation is a really complex task.

The Form module was last modified by Nicola on Tue 26 May 2009 05:41:32 PM CEST
Hosted by BerliOS Developer Logo