FormLib
[ class tree: FormLib ] [ index: FormLib ] [ all elements ]

Class: Form

Source Location: /FormLib/Form.php

Class Overview


Form class


Author(s):

  • Randy L. Pearson

Version:

  • 0.8

Variables

Methods



Class Details

[line 24]
Form class

This class is used to build an HTML form that consists of one or more fields and submit buttons. Normally not used directly, but instead used as a base class.

Version 0.8 changes the static load() function to return the form without calling the process() function. That means users of forms must do this themselves now. However, it also means that the form keeps its field values when successfully loaded.




Tags:

abstract:  
author:  Randy L. Pearson
version:  0.8


[ Top ]


Class Variables

$properties =

[line 62]

Private variables.



Tags:

access:  protected

Type:   mixed


[ Top ]



Class Methods


static method load [line 38]

static Form load( )

Helper function that decodes the POST data and determines

the name of the form, then creates the form and populates the values of all the fields automatically. If a form was posted, it also invokes the process() method so the form can handle the data in whatever fashion it deems necessary. Can you smell the polymorphism at work?

Returns false if no form was posted.




Tags:

return:  An instance of a Form derived class.


[ Top ]

constructor __construct [line 76]

Form __construct( string $title, string $name, string $action, array $fields, array $buttons, [ $properties = null], [PropertyHolder $style = false])

Form class constructor.

Initializes a Form object.




Tags:

access:  public


Parameters:

string   $title   Title (or caption) for the form.
string   $name   Name of this form.
string   $action   URL where form gets posted.
array   $fields   One or more Field objects.
array   $buttons   One or more Button objects.
PropertyHolder   $style   Extra style hints for the form.
   $properties  

[ Top ]

method display [line 139]

void display( )

Send the form to the user.

This function generates the HTML code for the form. The form will use a 2 column table to format the labels and fields. Also outputs the buttons as the last row of the table.




Tags:

access:  public


[ Top ]

method formEnd [line 208]

void formEnd( $style)

The default version of formEnd() closes the form.



Tags:

access:  protected


Parameters:

   $style  

[ Top ]

method formFooter [line 200]

void formFooter( $style)

The default version of formFooter() closes the table.



Tags:

access:  protected


Parameters:

   $style  

[ Top ]

method formHeader [line 192]

void formHeader( $style)

The default implementation of formHeader() outputs the form title in a row that spans 2 columns of the HTML table.



Tags:

access:  protected


Parameters:

   $style  

[ Top ]

method formStart [line 182]

void formStart( $style)

The default implementation of formStart() begins the form and starts an HTML table.



Tags:

access:  protected


Parameters:

   $style  

[ Top ]

method getField [line 170]

Field getField( string $fieldName)

Search for a field by name and return it.



Tags:

return:  The field if found, false if not found.
access:  public


Parameters:

string   $fieldName   The name of the field to search for.

[ Top ]

method isValid [line 213]

void isValid( )



Tags:

access:  public


[ Top ]

method process [line 57]

Form process( )

Derived form classes must implement this function.



Tags:

return:  Must return true if valthe form object ($this) or false on error.
access:  public
abstract:  


[ Top ]

method __get [line 115]

void __get( string $name)

Property accessor.



Tags:

access:  public


Parameters:

string   $name   Name of the property.

[ Top ]

method __set [line 126]

void __set( string $name, any $value)

Property mutator.



Tags:

access:  public


Parameters:

string   $name   Name of the property.
any   $value   Value to assign to the property.

[ Top ]


Documentation generated on Wed, 15 Nov 2006 08:48:04 -0600 by phpDocumentor 1.3.1