com.lokorin.lokorin.lib
[ class tree: com.lokorin.lokorin.lib ] [ index: com.lokorin.lokorin.lib ] [ all elements ]

Class: Form

Source Location: /_includes/lib_forms.php

Class Overview


Describes an form.


Author(s):

  • Andreas Launila

Variables

Methods



Class Details

[line 995]
Describes an form.



Tags:

author:  Andreas Launila


[ Top ]


Class Variables

$action =

[line 1007]

The action to be used by the form.



Tags:

access:  private

Type:   string


[ Top ]

$cssClass =

[line 1032]

The css class to be used by the form element.



Tags:

access:  private

Type:   string


[ Top ]

$displayErrors =

[line 1027]

If errors should be displayed or not (true by default).



Tags:

access:  private

Type:   boolean


[ Top ]

$encType =

[line 1022]

The encoding type to use for the form.



Tags:

access:  private

Type:   string


[ Top ]

$fields =

[line 1002]

Contains arrays describing contained fields with two keys each: (Field)field: The actual field.

(string)displayName: The name to be displayed for the field.




Tags:

access:  private

Type:   array


[ Top ]

$legend =

[line 1017]

The legend value that should be used for the form.



Tags:

access:  private

Type:   string


[ Top ]

$method =

[line 1012]

The method to be used by the form.



Tags:

access:  private

Type:   string


[ Top ]



Class Methods


constructor __construct [line 1045]

Form __construct( [string $legend = ''], [string $method = 'post'], [string $action = ''], [string $encType = ''])

Constructor for Form.



Tags:

access:  public


Parameters:

string   $legend   The legends that should be used for the form, none by default.
string   $method   The method to be used bt the form (post by default).
string   $action   The action to be used by the form. By default the action is set to the requested uri.
string   $encType   The encoding type that should be used for the form.

[ Top ]

method addField [line 1062]

void addField( field $field, [string $displayName = ''])

Adds a new field to the form.



Tags:

access:  public


Parameters:

field   $field   The actual field.
string   $displayName   The name that should be shown to the user. If nothing specified then nothing is shown to the user.

[ Top ]

method addFields [line 1074]

void addFields( array $fields)

Adds multiple fields to the form.



Tags:

access:  public


Parameters:

array   $fields   An array with key being the display name and value being the associated field.

[ Top ]

method clear [line 1206]

void clear( )

Removes all recorded field values from the form.



Tags:

access:  public


[ Top ]

method getError [line 1145]

void getError( )



Tags:

access:  public
see:  Validatable.getError()


[ Top ]

method getField [line 1154]

Field getField( string $name)

Gets the field instance corresponding to the given (field) name.



Tags:

return:  The requested field (if one is found), false otherwise.
access:  public


Parameters:

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

[ Top ]

method getForm [line 1084]

string getForm( )

Gets the (X)HTML representation of the form.



Tags:

return:  A form.
access:  public


[ Top ]

method getValue [line 1169]

mixed getValue( string $fieldName)

Gets the value of one of the form's fields.



Tags:

return:  The value of the field (if the field was found), an empty string otherwise.
access:  public


Parameters:

string   $fieldName   The name of the field to get the value for.

[ Top ]

method hasAnyUserValue [line 1247]

boolean hasAnyUserValue( )

Checks if any of the form's fields has any user set values.



Tags:

return:  True if at least a field has a non empty value that has been set by a user, false otherwise.
access:  public


[ Top ]

method hasValue [line 1185]

boolean hasValue( string $fieldName)

Checks if the form has a field with the specified name and if that field has a non empty value.



Tags:

return:  True if the field exists and has a non empty value, false otherwise.
access:  public


Parameters:

string   $fieldName   The name of the field to check.

[ Top ]

method isValid [line 1133]

void isValid( )



Tags:

access:  public
see:  Validatable.isValid()


[ Top ]

method removeField [line 1233]

void removeField( string $fieldName)

Removes the first field encountered with the specified field name.



Tags:

access:  public


Parameters:

string   $fieldName   The name of the field that should be removed.

[ Top ]

method setCssClass [line 1225]

void setCssClass( string $newCssClass)

Sets the css class to be used by the form element.



Tags:

access:  public


Parameters:

string   $newCssClass   The new css class name to use.

[ Top ]

method setDisplayErrors [line 1217]

void setDisplayErrors( boolean $newVal)

Sets if the form should display errors or not (the default is true).



Tags:

access:  public


Parameters:

boolean   $newVal   True if errors should be displayed, false otherwise.

[ Top ]

method setValue [line 1199]

void setValue( string $fieldName, mixed $newValue)

Sets a specified field's value to a new specified value.



Tags:

access:  public


Parameters:

string   $fieldName   The name of the field which's value should be set.
mixed   $newValue   The new value that should be used.

[ Top ]


Documentation generated on Sun, 16 Apr 2006 21:03:28 +0200 by phpDocumentor 1.3.0RC4