Docs For Class FormElement

## 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 /form/FormElement.inc (line 39)

Direct descendents

Class | Description
--- | ---
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.
FEText | This is the Text FormElement which builds a text input field. It has no validation method.
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.

Variable Summary
mixed $onBlurJS
mixed $onChangeJS
mixed $onClickJS
mixed $onFocusJS
mixed $onSubmitJS
mixed $_attributes
mixed $_element_name
mixed $_errors
mixed $_error_message
mixed $_form_name
mixed $_has_error
string $_has_form_on_submit
mixed $_is_disabled
mixed $_is_readonly
mixed $_is_required
mixed $_label_colon_flag
mixed $_label_text
mixed $_required_field_marker
mixed $_slave_elements
mixed $_stripslashes
mixed $_style_attributes
mixed $_validation_enabled
mixed $_value
Method Summary
FormElement FormElement (label $label, [bool $required = TRUE])
string build_id_name ([string $index = NULL])
void create_element_name ()
void enable_validation ([boolean $flag = TRUE])
string form_tag_onsubmit ()
mixed get_attribute (string $name)
INPUTtag get_confirm_element ()
object get_element ()
string get_element_name ([string. $string = NULL])
void get_errors (array 0)
mesage get_error_message ()
mixed &get_form_element ([bool $force_readonly = FALSE])
mixed get_init_value ()
object SPANtag get_label ([FormContent $form_content = NULL], [string $label = ''], [mixed $indent_flag = TRUE])
string get_label_text ()
string get_required_symbol ()
array &get_slave_elements ()
int get_tabindex ()
mixed get_value ()
string get_value_text (mixed 0)
bool has_error ([mixed $label = NULL])
bool is_disabled ()
bool is_readonly ()
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_colon_flag ([mixed $flag = TRUE])
void set_data_all_slaves (string $parentValue)
void set_disabled (bool $flag)
none set_element_name (string $name)
void set_error_message (mesage $message, [label $label = NULL])
void set_form_name (string $name)
void set_label_text (label $label)
void set_onBlur (string $js)
void set_onChange (string $js)
void set_onClick (string $js)
void set_onFocus (string $js)
void set_onSubmit (string $js)
void set_readonly ([bool $flag = TRUE])
void set_required (bool $required)
void set_required_symbol (string $symbol)
void set_slave_data (the &$slave, the $parentValue)
void set_slave_elements (array $slaveElements)
void set_stripslashes ([boolean $flag = TRUE])
void set_style_attribute (string $name, mixed $value)
void set_tabindex (int $index)
void set_title (string $title)
void set_value (value $value)
void validate (FormValidation &$_FormValidation)
array _build_element_attributes ()
array _build_javascript ()
void _do_validation (FormValidation &$_FormValidation)
string _sanitize_string (string $name)
Variables
mixed $onBlurJS = NULL (line 184)

variable to store JS onclick

mixed $onChangeJS = NULL (line 174)

variable to store JS onclick

mixed $onClickJS = NULL (line 164)

variable to store JS onclick

mixed $onFocusJS = NULL (line 169)

variable to store JS onclick

mixed $onSubmitJS = NULL (line 179)

variable to store JS onclick

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

Redefined in descendants as:

- FERegEx::$_error_message

mixed $_form_name (line 132)

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

string $_has_form_on_submit = false (line 141)

This Form Element needs to propogate some js to the Form tag's onsubmit attribute

Redefined in descendants as:

- FEComboListBox::$_has_form_on_submit : This Form Element needs to propogate some js to the Form tag's onsubmit attribute

mixed $_is_disabled = FALSE (line 105)

Indicates a disabled element

mixed $_is_readonly = FALSE (line 113)

Indicates this element is read only. The get_element() will return the get_value_text() instead of the form.

mixed $_is_required = TRUE (line 58)

Indicates whether this elements

final value is required and cannot be empty

mixed $_label_colon_flag = FALSE (line 159)

The form Element's flag to add the : character at the end of the label.

mixed $_label_text = NULL (line 45)

Holds the elements label text

mixed $_required_field_marker = "*" (line 153)

The required field string

mixed $_slave_elements (line 147)

This holds an array of FormElement objects

that are slaves of this element

mixed $_stripslashes = FALSE (line 125)

automatically strip slashes from

form values?

mixed $_style_attributes (line 99)

Holds additional style attributes for

the elements html tag

mixed $_validation_enabled = TRUE (line 119)

Flag to tell us to enable

validation or not

mixed $_value = NULL (line 51)

Holds the elements initial value

Methods
Constructor FormElement (line 192)

The constructor

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

- label $label: string - text label for the element
- bool $required: required - is this a required element

build_id_name (line 950)

This private method is used to build the id attribute value string

string build_id_name ([string $index = NULL])

- string $index: an index to append to the end of the generated ID string. This is usefull for complex FormElements

create_element_name (line 597)

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:

- FEMultiListBox::create_element_name() : This function creates element name used in the form based on the text label or any other parameters

enable_validation (line 659)

This method sets a flag to enable/disable validation for the Element.

void enable_validation ([boolean $flag = TRUE])

- boolean $flag: TRUE = enable validation

form_tag_onsubmit (line 871)

This is a method for getting the JS needed for the form tag's onsubmit attribute.

string form_tag_onsubmit ()

Redefined in descendants as:

- FEComboListBox::form_tag_onsubmit() : This is a method for getting the JS needed for the form tag's onsubmit attribute.

get_attribute (line 478)

return a single attribute

- return: the value

mixed get_attribute (string $name)

- string $name: attribute name

get_confirm_element (line 1055)

This method returns the hidden version of this element for a confirmation page.

NOTE: This is called by the FormProcessor only. It shouldn't be called manually.

- return: of type hidden

INPUTtag get_confirm_element ()

Redefined in descendants as:

- FEComboListBox::get_confirm_element() : This method returns the hidden version of this element for a confirmation page.
- FEDate::get_confirm_element() : This method returns the hidden version of this element for a confirmation page.
- FEFile::get_confirm_element() : This method returns the hidden version of this element for a confirmation page.
- FEHidden::get_confirm_element() : This method returns the hidden version of this element for a confirmation page.

get_element (line 1038)

This function builds and returns the form element object. This method ignores the readonly flag.

object get_element ()

Redefined in descendants as:

- FEButton::get_element() : This function builds and returns the form element object
- FESubmitButton::get_element() : This function builds and returns the form element object
- FEListBox::get_element() : This function builds and returns the form element object
- FEMultiListBox::get_element() : This function builds and returns the form element object
- FECheckBoxList::get_element() : This function builds and returns the form element object
- FENestedListBox::get_element() : This function builds and returns the form element object
- FEComboListBox::get_element() : This function builds and returns the form element object
- FEComboListButtonsBox::get_element()
- FEDate::get_element() : This function builds and returns the form element object
- FETextArea::get_element() : This function builds and returns the form element object
- FECheckBox::get_element() : This function builds and returns the form element object
- FERadioGroup::get_element() : This function builds and returns the form element object
- FEText::get_element() : This function builds and returns the form element object
- FEFile::get_element() : This function builds and returns the form element object
- FEPassword::get_element() : This function builds and returns the form element object
- FEHostNameWithPort::get_element() : This function builds and returns the form element object
- FEColorPicker::get_element()
- FEHidden::get_element()

get_element_name (line 643)

Returns the element name to be used in the form

- return: form element name

string get_element_name ([string. $string = NULL])

- string. $string: If you pass in a string It will generate the name and return that instead of the locally created name.

get_errors (line 552)

This returns the array of errors for this element

void get_errors (array 0)

- array 0: of errors

get_error_message (line 563)

Returns the current error message if any

- return: text - error message

mesage get_error_message ()
get_form_element (line 1018)

This method checks to see if

this element is readonly and returns the get_value_text() or returns get_element() if it isn't readonly

mixed &get_form_element ([bool $force_readonly = FALSE])

- bool $force_readonly: force readonly?

get_init_value (line 383)

This returns the initial value of the element

mixed get_init_value ()

Redefined in descendants as:

- FEComboListBox::get_init_value() : This returns the initial value of the element

get_label (line 970)

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

object SPANtag get_label ([FormContent $form_content = NULL], [string $label = ''], [mixed $indent_flag = TRUE])

- FormContent $form_content: object that holds the required field marker
- string $label: this string allows us to use this method and wrap any string as a FormElement label.

Redefined in descendants as:

- FENumberInRange::get_label() : This function builds and returns a label object based on the label text and error conditions

get_label_text (line 243)

This function will return the elements label text

string get_label_text ()
get_required_symbol (line 885)

This function return the symbol used to denote a required field

- return: - required symbol

string get_required_symbol ()
get_slave_elements (line 210)

This function will return the slaves of this element

- return: of slave elements

array &get_slave_elements ()
get_tabindex (line 515)

Gets the current tab index if any

- return: returns 0 if there is none set.

int get_tabindex ()
get_value (line 273)

This function will return the elements value

mixed get_value ()

Redefined in descendants as:

- FEComboListBox::get_value() : This function will return the elements value
- FEDate::get_value() : This function will return the elements value as an array or month, day and year
- FEFile::get_value() : This function will return the elements value

get_value_text (line 351)

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 0)

- mixed 0: the value to look up

Redefined in descendants as:

- FEDataList::get_value_text() : This provides a method
- FEMultiListBox::get_value_text() : build the string for the confirmation page
- FENestedListBox::get_value_text() : This provides a method
- FEComboListBox::get_value_text() : This provides a method
- FEDate::get_value_text() : This returns a formatted string used for the confirmation display (and possibly elsewhere)
- FECheckBox::get_value_text() : This provides a method
- FERadioGroup::get_value_text() : This provides a method
- FEFile::get_value_text()
- FEPassword::get_value_text() : return a string to the user for the confirmation page

has_error (line 573)

Returns the current error state

- return: error state

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

Returns the elements disabled state

- return: disabled

bool is_disabled ()
is_readonly (line 436)

Is this element in read only mode?

bool is_readonly ()
is_required (line 372)

Returns whether this elements final value cannot be empty

- return: requried

bool is_required ()
javascript (line 721)

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 ()

Redefined in descendants as:

- FECheckBoxList::javascript() : This returns the JS require to do the work of the check all checkbox
- FEListBoxMaster::javascript() : 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
- FEComboListBox::javascript() : This method builds the Javascript needed for this element.
- FEComboListButtonsBox::javascript()
- FEActiveDIVRadioButtonGroup::javascript()
- FEColorPicker::javascript() : The javascript required for the layer to work

onBlur (line 802)

This function return the javaScript code for

an onBlur event Note: if you override this function be sure to use the appropriate $this->onClickJS and append your JS to it before returning

- return: - javascript code

string onBlur ()
onChange (line 822)

this function retuns the javaScript code for

an onChange event Note: if you override this function be sure to use the appropriate $this->onClickJS and append your JS to it before returning

- return: - javascript code

string onChange ()

Redefined in descendants as:

- FEListBoxMaster::onChange() : this function retuns the javaScript code for an onChange event

onClick (line 742)

This function return the javaScript code for

an onClick event Note: if you override this function be sure to use the appropriate $this->onClickJS and append your JS to it before returning

- return: - javascript code

string onClick ()

Redefined in descendants as:

- FEButton::onClick() : This function return the javaScript code for an onClick event
- FESubmitButton::onClick() : This function return the javaScript code for an onSubmit event

onFocus (line 762)

This function return the javaScript code for

an onFocus event Note: if you override this function be sure to use the appropriate $this->onClickJS and append your JS to it before returning

- return: - javascript code

string onFocus ()
onSubmit (line 782)

This function return the javaScript code for

an onSubmit event Note: if you override this function be sure to use the appropriate $this->onClickJS and append your JS to it before returning

- return: - javascript code

string onSubmit ()
set_attribute (line 462)

add a single attribute (name="value")

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

- string $name: attribute name
- mixed $value: the value

set_colon_flag (line 263)

This method sets the flag to have ALL of the FormElement's labels be appended with a : character. Some folks like this for some completely unexplained reason.

void set_colon_flag ([mixed $flag = TRUE])
set_data_all_slaves (line 316)

This function will call set_slave_data for all slaves should be called when value of parent changes

void set_data_all_slaves (string $parentValue)

- string $parentValue: - the current value of parent

set_disabled (line 393)

Sets the disabled element flag

void set_disabled (bool $flag)

- bool $flag: disabled

Redefined in descendants as:

- FEDate::set_disabled() : Sets the disabled element flag

set_element_name (line 630)

This allows you to force the element name to whatever you like, so you don't have to use the default name, which is generated based on the label.

none set_element_name (string $name)

- string $name: the form element's name

set_error_message (line 537)

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 334)

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

Redefined in descendants as:

- FEDate::set_form_name() : We need to override this so we get the form name set in the child elements so the id attributes are set correctly.

set_label_text (line 253)

This function will set the label for the element

void set_label_text (label $label)

- label $label: string

set_onBlur (line 790)

This method sets the onblur javascript

void set_onBlur (string $js)

- string $js: - js code

set_onChange (line 810)

This method sets the onChange javascript

void set_onChange (string $js)

- string $js: - js code

set_onClick (line 729)

This method sets the onclick javascript

void set_onClick (string $js)

- string $js: - js code

set_onFocus (line 750)

This method sets the onfocus javascript

void set_onFocus (string $js)

- string $js: - js code

set_onSubmit (line 770)

This method sets the onSubmit javascript

void set_onSubmit (string $js)

- string $js: - js code

set_readonly (line 427)

This sets the readonly flag.

When this flag is set, the FormContent gets back the get_value_text() instead of get_element().

void set_readonly ([bool $flag = TRUE])

- bool $flag: TRUE = readonly

set_required (line 362)

This function set the elements required state

void set_required (bool $required)

- bool $required: required

set_required_symbol (line 899)

This allows you to customize the require string marker

void set_required_symbol (string $symbol)

- string $symbol

set_slave_data (line 233)

This function will set the data the parent wants to set for the slave

void set_slave_data (the &$slave, the $parentValue)

- the &$slave: slave
- the $parentValue: value being set for the parent

Redefined in descendants as:

- FEListBoxMaster::set_slave_data() : This function will set the data the parent wants to set for the slave

set_slave_elements (line 220)

This function will set the slaves of this element

void set_slave_elements (array $slaveElements)

- array $slaveElements: of slave elements (element references &)

set_stripslashes (line 447)

This sets the stripslashes flag for this object.

void set_stripslashes ([boolean $flag = TRUE])

- boolean $flag

set_style_attribute (line 497)

Sets elements css attribute

void set_style_attribute (string $name, mixed $value)

- string $name: attribute name
- mixed $value: the value

set_tabindex (line 506)

Sets the element's tab index

void set_tabindex (int $index)

- int $index: the # for the tabindex

set_title (line 487)

Sets elements title text

void set_title (string $title)

- string $title: title

set_value (line 305)

This function will set the initial value for the element

void set_value (value $value)

- value $value: mixed

Redefined in descendants as:

- FEComboListBox::set_value() : This function will set the initial value for the element
- FEDate::set_value() : Set the value of the element

validate (line 675)

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)

- FormValidation &$_FormValidation: object.

Redefined in descendants as:

- FEDataList::validate() : This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation
- FENestedListBox::validate() : This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation
- FEComboListBox::validate() : This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation
- FEDate::validate() : This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation
- FETextArea::validate() : This method validates the data for this Form Element.
- FEFile::validate() : This method validates the data for this Form Element.
- FENumber::validate() : This method validates the data for this Form Element.
- FENumberFloat::validate() : This method validates the data for this Form Element.
- FENumberPrice::validate() : This method validates the data for this Form Element.
- FENumberInRange::validate() : This method validates the data for this Form Element.
- FEPassword::validate() : This function performs the actual validation It is called only if the validation is required by this element
- FEConfirmPassword::validate() : This function performs the actual validation It is called only if the validation is required by this element
- FEName::validate() : This method validates the data for this Form Element.
- FEEmail::validate() : This method validates the data for this Form Element.
- FEEmailMany::validate() : This method validates the data for this Form Element.
- FEDomainName::validate() : This method validates the data for this Form Element.
- FEHostNameWithPort::validate() : This method validates the data for this Form Element.
- FEIPAddress::validate() : This method validates the data for this Form Element.
- FEUrl::validate() : This method validates the data for this Form Element.
- FEUrlStrict::validate() : This method validates the data for this Form Element.
- FEZipcode::validate() : This method validates the data for this Form Element.
- FERegEx::validate() : This method validates the data for this Form Element.
- FEColorPicker::validate() : This method validates to make sure it has a valid 6digit hex color

_build_element_attributes (line 908)

This function builds the element form attributes

- return: attributes

array _build_element_attributes ()
_build_javascript (line 832)

This function builds the complete javaScript events code for the element

- return: - attributes

array _build_javascript ()
_do_validation (line 686)

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

void _do_validation (FormValidation &$_FormValidation)

- FormValidation &$_FormValidation: object.

_sanitize_string (line 609)

This private method sanitizes a string for putting in a form element attribute value

string _sanitize_string (string $name)

- string $name: the string to sanitize

Documentation generated on Thu, 1 Sep 2005 17:05:59 -0700 by phpDocumentor 1.3.0RC3