Class FormElement

Description

This is the base FormElement object. It can be single form field such as a text input field, or a complex object.

Usefull Functions

get_value() - This gets the current 'value' of the FormElement. NOTE: This can be a 'complex' FormElement in which it may return an array of values.

set_value() - Set the current value for this FormElement.

get_label() - returns the label for this FormElement.

Located in Program_Root/form/FormElement.inc (line 39)


	
			
Direct descendents
Class Description
FEHidden This is the Hidden FormElement which builds a input field of type="hidden". It has no validation method.
FEError This is a way of providing an Error to the FormProcessor.
FEText This is the Text FormElement which builds a text input field. It has no validation method.
FEBoxElement This is the Box FormElement which builds a DIV with a width and a height. It is a base class for more complicated FormElements.
FECheckBox This is the CheckBox FormElement which builds a input field of type="checkbox". It has no validation method.
FERadioGroup This is the Radio Button Group FormElement which builds a List of Radio buttons that can be used in any style of layout.
Variable Summary
Method Summary
void FormElement (label $label, [bool $required = TRUE])
mixed get_attribute (string $name)
object get_element ()
string get_element_name ()
void get_errors (array 0)
mesage get_error_message ()
mixed get_init_value ()
string get_label_text ()
mixed get_value ()
string get_value_text (mixed $value)
bool has_error ([mixed $label = NULL])
bool is_disabled ()
bool is_required ()
string javascript ()
string onBlur ()
string onChange ()
string onClick ()
string onFocus ()
string onSubmit ()
void set_attribute (string $name, [mixed $value = NULL])
void set_disabled (bool $flag)
void set_error_message (mesage $message, [label $label = NULL])
void set_form_name (string $name)
void set_label_text (label $label)
void set_required (bool $required)
void set_stripslashes ([boolean $flag = TRUE])
void set_style_attribute (string $name, mixed $value)
void set_title (string $title)
void set_value (value $value)
void validate (FormValidation &$_FormValidation)
void _do_validation (FormValidation &$_FormValidation)
Variables
mixed $_attributes (line 92)

Holds additional attributes for

the elements html tag

mixed $_element_name = NULL (line 85)

Holds the name of the element

as it appears in the form html tag

mixed $_errors = array() (line 64)

holds the array of errors for this element.

mixed $_error_message = NULL (line 71)

Holds the error message text

for validation errors, if any

mixed $_form_name (line 118)

This holds the name of the form

for js that needs it

mixed $_has_error = FALSE (line 78)

Holds the state of the last validation

Sets to true in case of a validation error

mixed $_is_disabled = FALSE (line 105)

Indicates a disabled element

mixed $_is_required = TRUE (line 58)

Indicates whether this elements

final value is required and cannot be empty

mixed $_label_text = NULL (line 45)

Holds the elements label text

mixed $_stripslashes = FALSE (line 111)

automatically strip slashes from

form values?

mixed $_style_attributes (line 99)

Holds additional style attributes for

the elements html tag

mixed $_value = NULL (line 51)

Holds the elements initial value

Methods
Constructor FormElement (line 127)

The constructor

void FormElement (label $label, [bool $required = TRUE])
  • label $label:

    string - text label for the element

  • bool $required:

    required - is this a required element

create_element_name (line 401)

This function creates element name

used in the form based on the text label or any other parameters

void create_element_name ()

Redefined in descendants as:
get_attribute (line 301)

return a single attribute

  • return:

    the value

mixed get_attribute (string $name)
  • string $name:

    attribute name

get_element (line 656)

This function builds and returns the form element object

object get_element ()

Redefined in descendants as:
get_element_name (line 420)

Returns the element name to be used in the form

  • return:

    form element name

string get_element_name ()
get_errors (line 353)

This returns the array of errors for this element

void get_errors (array 0)
  • array 0:

    of errors

get_error_message (line 364)

Returns the current error message if any

  • return:

    text - error message

mesage get_error_message ()
get_init_value (line 240)

This returns the initial value of the element

mixed get_init_value ()
get_label (line 634)

This function builds and returns a label object based on the label text and error conditions

object SPANtag get_label ()

Redefined in descendants as:
get_label_text (line 146)

This function will return the elements label text

string get_label_text ()
get_required_symbol (line 589)

This function return the symbol used to denote a required field

  • return:

    - required symbol

string get_required_symbol ()
get_value (line 166)

This function will return the elements value

mixed get_value ()

Redefined in descendants as:
get_value_text (line 208)

This provides a method

for the FormContent to get access to the text associated with a field. This is only available on FormElements that have text associated with a field. It is used during Confirmation

  • return:

    - the text associated

string get_value_text (mixed $value)
  • mixed $value:

    - the value to look up


Redefined in descendants as:
has_error (line 374)

Returns the current error state

  • return:

    error state

bool has_error ([mixed $label = NULL])
is_disabled (line 260)

Returns the elements disabled state

  • return:

    disabled

bool is_disabled ()
is_required (line 229)

Returns whether this elements final value cannot be empty

  • return:

    requried

bool is_required ()
javascript (line 486)

This method is used for adding any javascript that is used by this element. This will automatically get called and added to the page by the FormProcessor

  • return:

    - raw js

string javascript ()
onBlur (line 526)

This function return the javaScript code for an onBlur event

  • return:

    - javascript code

string onBlur ()
onChange (line 537)

this function retuns the javaScript code for an onChange event

  • return:

    - javascript code

string onChange ()
onClick (line 496)

This function return the javaScript code for an onClick event

  • return:

    - javascript code

string onClick ()

Redefined in descendants as:
onFocus (line 506)

This function return the javaScript code for an onFocus event

  • return:

    - javascript code

string onFocus ()
onSubmit (line 516)

This function return the javaScript code for an onSubmit event

  • return:

    - javascript code

string onSubmit ()
set_attribute (line 285)

add a single attribute (name="value")

void set_attribute (string $name, [mixed $value = NULL])
  • string $name:

    attribute name

  • mixed $value:

    the value

set_disabled (line 250)

Sets the disabled element flag

void set_disabled (bool $flag)
  • bool $flag:

    disabled

set_error_message (line 338)

Defines error message text and sets the error flag to true

void set_error_message (mesage $message, [label $label = NULL])
  • mesage $message:

    text - error message

  • label $label:

    text - a label to provide for the error. This is only needed for a complex element that has multiple 'hidden/magic' fields.

set_form_name (line 191)

in case anyone in JS land needs the name of the form that this element lives in

void set_form_name (string $name)
  • string $name:

    - the form name

set_label_text (line 156)

This function will set the label for the element

void set_label_text (label $label)
  • label $label:

    string

set_required (line 219)

This function set the elements required state

void set_required (bool $required)
  • bool $required:

    required

set_stripslashes (line 270)

This sets the stripslashes flag for this object.

void set_stripslashes ([boolean $flag = TRUE])
  • boolean $flag
set_style_attribute (line 320)

Sets elements css attribute

void set_style_attribute (string $name, mixed $value)
  • string $name:

    attribute name

  • mixed $value:

    the value

set_title (line 310)

Sets elements title text

void set_title (string $title)
  • string $title:

    title

set_value (line 180)

This function will set the initial value for the element

void set_value (value $value)
  • value $value:

    mixed

validate (line 439)

This function performs the actual validation It is called only if the validation is required by this element

This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation

void validate (FormValidation &$_FormValidation)

Redefined in descendants as:
_build_element_attributes (line 598)

This function builds the element form attributes

  • return:

    attributes

array _build_element_attributes ()
_build_javascript (line 547)

This function builds the complete javaScript events code for the element

  • return:

    - attributes

array _build_javascript ()
_do_validation (line 450)

This function checks if the validation is nesseccary and calls the validate method

void _do_validation (FormValidation &$_FormValidation)

Documention generated on Thu, 31 Jul 2003 18:32:43 -0700 by phpDocumentor 1.2.0