Provides form abstraction, integrating retrieval and validation into one package.

author Jorgen Evens
package WebLab

 Methods

Construct new form

__construct(string $action, string $method) 

Parameters

$action

string

$method

string

Returns a field with $name.

__get(string $name) : \WebLab_Form_Field
deprecated

Parameters

$name

string

Returns

Returns whether a field is set.

__isset(string $name) : boolean
deprecated

Parameters

$name

string

Returns

boolean

Add a field to the form

add(\WebLab_Form_Field $field) 

Parameters

Exceptions

\WebLab_Exception_Form

Returns a field with $name

get(string $name) : \WebLab_Form_Field | array

Parameters

$name

string

Returns

Return the action that this form is configured with.

getAction() : string

Returns

string

Retrieve validation errors.

getErrors() : \multitype:

Returns

\multitype:

Get a list of the fields.

getFields() : array

Returns

array

Generates a ID by which the form can identify itself.

getFormId() : string

Returns

string

Return method being used.

getMethod() : string

Returns

string

Retrieve the correct response set

getResponse() : array

Returns

array

Get all fields their values.

getResults() : array
deprecated

Returns

array

Get the value of a field

getValue(\unknown_type $field) : string

Parameters

$field

\unknown_type

Exceptions

\WebLab_Exception_Form

Returns

string

Get all fields their values.

getValues() : array

Returns

array

Determine if we are dealing with a postback.

isPostback() : boolean

Returns

boolean

Determine if all fields are filled out correctly.

isValid() : boolean

Returns

boolean

Remove a field from the form

remove(string | \WebLab_Form_Field $field) : \WebLab_Form

Parameters

$field

string\WebLab_Form_Field

Exceptions

\WebLab_Exception_Form

Returns

Set the action to be used by this form

setAction(string $action) : \WebLab_Form

Parameters

$action

string

Exceptions

\Exception

Returns

Set method form is going to use.

setMethod(string $method) : \WebLab_Form

Parameters

$method

string

Exceptions

\WebLab_Exception_Form

Returns

Set value for a fields.

setValues(array $obj) : \WebLab_Form

Parameters

$obj

array

Returns

Update fields to correspond with posted value.

update() 

Declare fields used by this form.

_setupFields() 

Generate postback element

_setupPostback() 

Declare validation rules for this form.

_setupValidation() 

 Properties

 

$postback : \WebLab_Form_Input
 

$_action : string
 

$_method : string
 

$_errors : array
 

$_fields : array

 Constants

 

Constant for GET method

GET : string
 

Constant for POST method

POST : string