Class: FormBuilder

Source Location: /system/helpers/FormBuilder.php

Class Overview [line 39]


Author(s):

Version:

Copyright:

Variables

Constants

Methods


Inherited Variables

Inherited Constants

Inherited Methods



Class Details

[ Top ]


Class Variables

static $errors =  NULL

[line 44]

A list of all of the error messages possible for the form builder.

A list of all of the error messages possible for the form builder.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

static $inputTypes = array ( 
         FormBuilder::INPUT_TEXT => 'HTMLNormalInput', 
         FormBuilder::INPUT_PASSWORD => 'HTMLNormalInput',
         FormBuilder::INPUT_HIDDEN => 'HTMLNormalInput',
         FormBuilder::INPUT_FILE => 'HTMLNormalInput',
         FormBuilder::INPUT_TEXTAREA => 'HTMLTextAreaInput',
         FormBuilder::INPUT_DROPDOWNLIST => 'HTMLSelectList',
         FormBuilder::INPUT_MULTISELECT => 'HTMLSelectList',
         FormBuilder::INPUT_RADIO => 'HTMLNormalInput',
         FormBuilder::INPUT_CHECKBOX => 'HTMLNormalInput',
         FormBuilder::INPUT_SUBMIT => 'HTMLNormalInput',
         FormBuilder::INPUT_CLEAR => 'HTMLNormalInput',
         FormBuilder::INPUT_BUTTON => 'HTMLNormalInput'
    )

[line 77]

Tags:

  • access - public

Type: mixed

Overrides:

[ Top ]

$action =  NULL

[line 106]

The form action which will be used.

The form action which will be used.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$elementCount =  0

[line 120]

The count of how many elements are currently within the form object.

The count of how many elements are currently within the form object.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$formElements = array ()

[line 126]

An array of all of the elements which will be components included in the form being created.

An array of all of the elements which will be components included in the form being created.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$formMapping = array ()

[line 131]

The mapping table for each of the HTML elements (the names).

The mapping table for each of the HTML elements (the names).

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$formMD5 =  ''

[line 49]

The unique MD5 for this form instance.

The unique MD5 for this form instance.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$method =  NULL

[line 101]

The form method type which will be used.

The form method type which will be used.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]

$name =  NULL

[line 115]

The name attribute for the form. prefix any form fields in order to eliminate the chance of naming collisions between this form and other parts of the application.

The name attribute for the form. If set, this will automatically prefix any form fields in order to eliminate the chance of naming collisions between this form and other parts of the application. It will also be used as the form's ID for any form related javascript tasks which need to be done.

Tags:

  • access - private

Type: mixed

Overrides:

[ Top ]


Class Methods

addAttribute

void addAttribute( string $field, string $attribute, [string $value = ''])

[line 377]

This function is used in order to add an attribute to the corresponding field.

This function is used in order to add an attribute to the corresponding field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the attribute is being applied to
  • string $attribute - The name of the attribute to add to the field
  • string $value - The value which is associated with the attribute

[ Top ]

addCSSClass

void addCSSClass( string $field, string $class)

[line 222]

This function is used in order to set the CSS class for the specified input field (appends to the pre-existing CSS class).

This function is used in order to set the CSS class for the specified input field (appends to the pre-existing CSS class).

Tags:

  • access - public

Parameters:

  • string $field - The input field which the CSS class is being set
  • string $class - The CSS class to be added

[ Top ]

addElement

void addElement( $name $name, $type $type, [$value $value = ''], [$labelText $labelText = NULL])

[line 166]

This function is used in order to create a new input element which will be displayed on the view.

This function is used in order to create a new input element which will be displayed on the view.

Tags:

  • access - public

Parameters:

  • $name $name - The name of the new HTML element being added
  • $type $type - The HTML element type which is being added
  • $value $value - If provided, the default value for the input field
  • $labelText $labelText - If provided, a label will be generated for the input element

[ Top ]

addLabelCSSClass

void addLabelCSSClass( string $field, string $class)

[line 310]

This function is used in order to set the CSS class for the specified input field (appends to the pre-existing CSS class).

This function is used in order to set the CSS class for the specified input field (appends to the pre-existing CSS class).

Tags:

  • access - public

Parameters:

  • string $field - The input field which the CSS class is being set
  • string $class - The CSS class to be added

[ Top ]

clearAttributes

void clearAttributes( string $field)

[line 398]

This function is used in order to clear the attribute to the corresponding field.

This function is used in order to clear the attribute to the corresponding field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the attributes will be cleared

[ Top ]

clearCSSClass

void clearCSSClass( string $field, $class)

[line 243]

This function is used in order to clear the CSS information from a field.

This function is used in order to clear the CSS information from a field.

Tags:

  • access - public

Parameters:

  • string $field - - The input field which the CSS class is being cleared
  • $class -

[ Top ]

clearLabelCSSClass

void clearLabelCSSClass( string $field, $class)

[line 331]

This function is used in order to clear the CSS information from a field.

This function is used in order to clear the CSS information from a field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the CSS class is being cleared
  • $class -

[ Top ]

clearValues

void clearValues( string $field)

[line 465]

This function is used to clear the values associated with any specified input field.

This function is used to clear the values associated with any specified input field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the values will be cleared

[ Top ]

__construct

FormBuilder __construct( [string $name = ''], [string $method = ''], [string $action = ''])

[line 143]

The three-argument constructor for the Form Builder class which will initialize values which are required components of the form.

The three-argument constructor for the Form Builder class which will initialize values which are required components of the form.

Tags:

  • access - public

Parameters:

  • string $name - The name which the form goes by.
  • string $method - The method which the form will be used for the form. This defaults to empty but should either be 'post' or 'get'.
  • string $action - The action which the form will take (i.e. where the page will be sent to)

[ Top ]

getAction

string getAction( )

[line 739]

The getter for the form's action attribute.

The getter for the form's action attribute.

Tags:

  • return - The form's action attribute
  • access - public

Parameters:

[ Top ]

getCSSClass

The getCSSClass( string $field)

[line 263]

The getter for the CSS class for a particular field.

The getter for the CSS class for a particular field.

Tags:

  • return - current CSS class for the field
  • access - public

Parameters:

  • string $field - The input field which the CSS class is being retreived

[ Top ]

getLabelCSSClass

The getLabelCSSClass( string $field)

[line 351]

The getter for the CSS class for a particular label.

The getter for the CSS class for a particular label.

Tags:

  • return - current CSS class for the label
  • access - public

Parameters:

  • string $field - The input field which the CSS class is being retreived

[ Top ]

getMethod

string getMethod( )

[line 769]

The getter for the form's method attribute

The getter for the form's method attribute

Tags:

  • return - The form's method attribute
  • access - public

Parameters:

[ Top ]

getName

string getName( )

[line 721]

The getter for the form's name attribute.

The getter for the form's name attribute.

Tags:

  • return - The form's name attribute.
  • access - public

Parameters:

[ Top ]

getRemember

void getRemember( string $field)

[line 534]

This function is used in order to retrieve whether or not a value will be remembered after processing the form.

This function is used in order to retrieve whether or not a value will be remembered after processing the form.

Tags:

  • access - public

Parameters:

  • string $field - The input field which will have the value retrieved

[ Top ]

getValue

void getValue( string $field)

[line 510]

This function is used in order to retrieve the value which is associated the specified field (posted or default).

This function is used in order to retrieve the value which is associated the specified field (posted or default).

Tags:

  • access - public

Parameters:

  • string $field - The input field which will have the value retrieved

[ Top ]

getValues

void getValues( string $field)

[line 487]

This function is used to retrieve the values associated with any specified input field.

This function is used to retrieve the values associated with any specified input field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the values will be retrieved

[ Top ]

initializeValues

void initializeValues( )

[line 585]

This function should be called in order to initialize all of the values for the form. in the corresponding request (either $_POST or $_GET will be set) based on the actual field names. it to the one specified by the developer so they can access the information from these fields as they normally would. remember the value for the field has been set, then the field will maintain the value after submission.

This function should be called in order to initialize all of the values for the form. If the form has been submitted, then all of the variables in the corresponding request (either $_POST or $_GET will be set) based on the actual field names. (i.e. it takes the unique names and converts it to the one specified by the developer so they can access the information from these fields as they normally would.) If the option to remember the value for the field has been set, then the field will maintain the value after submission.

Tags:

  • access - public

Parameters:

[ Top ]

setAction

void setAction( string $action)

[line 730]

The setter for the form's action attribute.

The setter for the form's action attribute.

Tags:

  • access - public

Parameters:

  • string $action - The action to completed by the form

[ Top ]

setCSSClass

void setCSSClass( string $field, string $class)

[line 200]

This function is used in order to set the CSS class for the specified input field (overwrites the pre-existing CSS class).

This function is used in order to set the CSS class for the specified input field (overwrites the pre-existing CSS class).

Tags:

  • access - public

Parameters:

  • string $field - The input field which the CSS class is being set
  • string $class - The new CSS class

[ Top ]

setLabelCSSClass

void setLabelCSSClass( string $field, string $class)

[line 288]

This function is used in order to set the CSS class for the specified input field (overwrites the pre-existing CSS class).

This function is used in order to set the CSS class for the specified input field (overwrites the pre-existing CSS class).

Tags:

  • access - public

Parameters:

  • string $field - The input field which the CSS class is being set
  • string $class - The new CSS class

[ Top ]

setMethod

void setMethod( string $method)

[line 749]

The setter for the form's method attribute. method type has been porivded and one accept it if that is the case.

The setter for the form's method attribute. It will verify that a valid method type has been porivded and one accept it if that is the case.

Tags:

  • access - public

Parameters:

  • string $method - The method type which is desired

[ Top ]

setName

void setName( string $name)

[line 669]

The setter for the form's name attribute. extremely helpful because it will help to eliminate naming collisions by prefixing the name of input field with this name.

The setter for the form's name attribute. The use of this field is extremely helpful because it will help to eliminate naming collisions by prefixing the name of input field with this name.

Tags:

  • access - public

Parameters:

  • string $name - The name of the form

[ Top ]

setRemember

void setRemember( string $field, boolean $remember)

[line 559]

This function is used in order to set whether or not a value will be remembered after processing the form.

This function is used in order to set whether or not a value will be remembered after processing the form.

Tags:

  • access - public

Parameters:

  • string $field - The input field which will have the value retrieved
  • boolean $remember - Whether the value should be remembered each postback

[ Top ]

setValue

void setValue( string $field, string $value, boolean $append)

[line 419]

This function is used to set the value associated with the specified input field.

This function is used to set the value associated with the specified input field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the values will be added to
  • string $value - The value which will be set for / added to the field
  • boolean $append - TRUE if the values should be appened, FALSE otherwise

[ Top ]

setValues

void setValues( string $field, mixed $values, [boolean $append = FALSE])

[line 443]

This function is used to set the value associated with the specified input field.

This function is used to set the value associated with the specified input field.

Tags:

  • access - public

Parameters:

  • string $field - The input field which the values will be added to
  • mixed $values - The values which will be set for / added to the field
  • boolean $append - TRUE if the values should be appened, FALSE otherwise

[ Top ]

toHTML

string toHTML( )

[line 612]

This function is used in order to return the HTML equivalent of the form which was created.

This function is used in order to return the HTML equivalent of the form which was created.

Tags:

  • return - The form which was created piece by piece
  • access - public

Parameters:

[ Top ]

toHTMLArray

array toHTMLArray( )

[line 640]

This function is used in order to return the HTML equivalent of the form which was created.

This function is used in order to return the HTML equivalent of the form which was created.

Tags:

  • return - The form which was created piece by piece each element as a part of an array
  • access - public

Parameters:

[ Top ]

updateFormElements

void updateFormElements( $elements)

[line 697]

This function is used in order to cycle through each of the input elements which were created for this form, and update each of their form attributes accordingly.

This function is used in order to cycle through each of the input elements which were created for this form, and update each of their form attributes accordingly.

Tags:

  • access - private

Parameters:

  • array $elements - An array of elements to iterate through

[ Top ]


Class Constants

GET =  'get'

[line 59]

Constant for the form method.

Constant for the form method.for a form GET

[ Top ]

HTML =  'HTML'

[line 95]

Constants for the form builder output array.

Constants for the form builder output array.

[ Top ]

INPUT_BUTTON =  'button'

[line 75]

[ Top ]

INPUT_CHECKBOX =  'checkbox'

[line 72]

[ Top ]

INPUT_CLEAR =  'clear'

[line 74]

[ Top ]

INPUT_DROPDOWNLIST =  'dropdownlist'

[line 69]

[ Top ]

INPUT_FILE =  'file'

[line 67]

[ Top ]

INPUT_HIDDEN =  'hidden'

[line 66]

[ Top ]

INPUT_MULTISELECT =  'multiselect'

[line 70]

[ Top ]

INPUT_PASSWORD =  'password'

[line 65]

[ Top ]

INPUT_RADIO =  'radio'

[line 71]

[ Top ]

INPUT_SUBMIT =  'submit'

[line 73]

[ Top ]

INPUT_TEXT =  'text'

[line 64]

Form input types - list of all acceptable and what they map to.

Form input types - list of all acceptable and what they map to.

[ Top ]

INPUT_TEXTAREA =  'textarea'

[line 68]

[ Top ]

LABEL =  'LABEL'

[line 96]

[ Top ]

POST =  'post'

[line 54]

Constant for the form method.

Constant for the form method.for a form POST

[ Top ]


Documentation generated on Sat, 30 Oct 2010 09:50:11 -0400 by phpDocumentor 1.4.3