Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

FormControl Class Reference

Inheritance diagram for FormControl:

List of all members.

Public Member Functions

 __construct ()
 get_form ()
 checksum ()
 save ($storage=null)
 get ($forvalidation=true)
 get_template ()
 pre_out ()
 validate ()
 errors_out ($format, $wrap= '%s')
 errors_get ($format, $wrap= '%s')
 __get ($name)
 __toString ()
 has_user_options ()
 __set ($name, $value)
 add_validator ()
 remove_validator ($name)
 move_into ($target)
 move_before ($target)
 move_after ($target)
 remove ()

Public Attributes

 $id = null
 $class = array( 'formcontrol' )
 $name
 $errors = array()

Protected Member Functions

 get_default ()
 get_theme ($forvalidation)

Protected Attributes

 $caption
 $default = null
 $validators = array()
 $storage
 $store_user = false
 $theme_obj
 $container = null
 $properties = array()
 $template = null
 $raw = false

Detailed Description

A base class from which form controls to be used with FormUI can descend

Definition at line 949 of file formui.php.


Constructor & Destructor Documentation

FormControl::__construct (  ) 

FormControl constructor - set initial settings of the control

Parameters:
string $storage The storage location for this control
string $default The default value of the control
string $caption The caption used as the label when displaying a control

Reimplemented in FormControlNoSave, FormControlTag, FormControlSelect, and FormControlTree.

Definition at line 973 of file formui.php.


Member Function Documentation

FormControl::__get ( name  ) 

Magic function __get returns properties for this object. Potential valid properties: field: A valid unique name for this control in HTML. value: The value of the control, whether the default or submitted in the form

Parameters:
string $name The parameter to retrieve
Returns:
mixed The value of the parameter

Reimplemented in FormControlPassword, FormControlCheckboxes, FormControlTree, FormControlCheckbox, and FormControlFile.

Definition at line 1251 of file formui.php.

FormControl::__set ( name,
value 
)

Magic property setter for FormControl and its descendants

Parameters:
string $name The name of the property
mixed $value The value to set the property to

Definition at line 1309 of file formui.php.

FormControl::add_validator (  ) 

Add a validation function to this control Multiple parameters are passed as parameters to the validation function

Parameters:
mixed $validator A callback function
mixed $option... Multiple parameters added to those used to call the validator callback
Returns:
FormControl Returns the control for chained execution

Definition at line 1366 of file formui.php.

FormControl::checksum (  ) 

Return a checksum representing this control

Returns:
string A checksum

Definition at line 1005 of file formui.php.

FormControl::errors_get ( format,
wrap = '%s' 
)

Return any validation errors on this control using the supplied format $this->validate must be called first!

string $format A sprintf()-style format string to format the validation error string $format A sprintf()-style format string to wrap the returned error, only if at least one error exists

Returns:
boolean true if the control has errors

Definition at line 1230 of file formui.php.

FormControl::errors_out ( format,
wrap = '%s' 
)

Output any validation errors on this control using the supplied format $this->validate must be called first!

string $format A sprintf()-style format string to format the validation error string $format A sprintf()-style format string to wrap the returned error, only if at least one error exists

Returns:
boolean true if the control has errors

Definition at line 1217 of file formui.php.

FormControl::get ( forvalidation = true  ) 

Return the HTML construction of the control. Abstract function.

Parameters:
boolean $forvalidation True if the control should output validation information with the control.

Reimplemented in FormControlStatic, FormControlTag, FormControlPassword, FormControlSelect, FormControlCheckboxes, FormControlTree, FormControlHidden, FormControlLabel, and FormControlFile.

Definition at line 1130 of file formui.php.

Referenced by get_default().

FormControl::get_default (  )  [protected]

Set the default value of this control from options or userinfo if the default value isn't explicitly set on creation

Definition at line 1015 of file formui.php.

Referenced by FormControlPassword::__get().

FormControl::get_form (  ) 

Retrieve the FormUI object that contains this control

Returns:
FormUI The containing form

Definition at line 991 of file formui.php.

FormControl::get_template (  ) 

Return the template name associated to this control, whether set explicitly or by class

Returns:
string The template used to display this control.

Definition at line 1151 of file formui.php.

Referenced by FormControlSelect::get(), and FormControlPassword::get().

FormControl::get_theme ( forvalidation  )  [protected]

Return the theme used to output this control and perform validation if required.

Parameters:
boolean $forvalidation If true, process this control for validation (adds validation failure messages to the theme)
Returns:
Theme The theme that will display this control

Definition at line 1353 of file formui.php.

Referenced by FormControlSelect::get(), and FormControlPassword::get().

FormControl::has_user_options (  ) 

Returns true if this control should be stored as userinfo

Returns:
boolean True if this control should be stored as userinfo

Definition at line 1284 of file formui.php.

FormControl::move_after ( target  ) 

Move this control after the target In the end, this will use FormUI::move()

Parameters:
object $target The target control to move this control after

Definition at line 1424 of file formui.php.

FormControl::move_before ( target  ) 

Move this control before the target In the end, this will use FormUI::move()

Parameters:
object $target The target control to move this control before

Definition at line 1413 of file formui.php.

FormControl::move_into ( target  ) 

Move this control inside of the target In the end, this will use FormUI::move()

Parameters:
object $target The target control to move this control before

Definition at line 1402 of file formui.php.

FormControl::pre_out (  ) 

Return the HTML/script required for this type of control. Abstract function.

Reimplemented in FormControlTextMulti, and FormControlTree.

Definition at line 1176 of file formui.php.

FormControl::remove (  ) 

Remove this controls from the form

Definition at line 1432 of file formui.php.

FormControl::remove_validator ( name  ) 

Removes a validation function from this control

Parameters:
string $name The name of the validator to remove

Definition at line 1385 of file formui.php.

FormControl::save ( storage = null  ) 

Store this control's value under the control's specified key.

Parameters:
string $storage (optional) A storage location to store the control data

Reimplemented in FormControlFile.

Definition at line 1069 of file formui.php.

FormControl::validate (  ) 

Runs any attached validation functions to check validation of this control.

Returns:
array An array of string validation error descriptions or an empty array if no errors were found.

Definition at line 1186 of file formui.php.


The documentation for this class was generated from the following file: