HTMLFormField Class Reference

The parent class to generate form fields. More...

Inherited by HTMLCheckField, HTMLEditTools, HTMLHiddenField, HTMLInfoField, HTMLMultiSelectField, HTMLRadioField, HTMLSelectField, HTMLSubmitField, HTMLTextAreaField, HTMLTextField, and Licenses.

List of all members.

Public Member Functions

 getInputHTML ($value)
 This function must be implemented to return the HTML to generate the input object itself.
 validate ($value, $alldata)
 Override this function to add specific validation checks on the field input.
 filter ($value, $alldata)
 loadDataFromRequest ($request)
 Get the value that this input has been set to from a posted form, or the input's default value if it has not been set.
 __construct ($params)
 Initialise the object.
 getTableRow ($value)
 Get the complete table row for the input, including help text, labels, and whatever.
 getLabel ()
 getLabelHtml ()
 getDefault ()
 getTooltipAndAccessKey ()
 Returns the attributes required for the tooltip and accesskey.

Static Public Member Functions

static flattenOptions ($options)
 flatten an array of options to a single array, for instance, a set of <options> inside <optgroups>.

Public Attributes

 $mParams
 $mParent

Protected Member Functions

 needsLabel ()
 Should this field have a label, or is there no input element with the appropriate id for the label to point to?

Protected Attributes

 $mValidationCallback
 $mFilterCallback
 $mName
 $mLabel
 $mID
 $mDefault


Detailed Description

The parent class to generate form fields.

Any field type should be a subclass of this.

Definition at line 640 of file HTMLForm.php.


Constructor & Destructor Documentation

HTMLFormField::__construct ( params  ) 

Initialise the object.

Parameters:
$params Associative Array. See HTMLForm doc for syntax.

Reimplemented in HTMLSelectOrOtherField, HTMLInfoField, and Licenses.

Definition at line 713 of file HTMLForm.php.


Member Function Documentation

HTMLFormField::filter ( value,
alldata 
)

Definition at line 677 of file HTMLForm.php.

static HTMLFormField::flattenOptions ( options  )  [static]

flatten an array of options to a single array, for instance, a set of <options> inside <optgroups>.

Parameters:
$options Associative Array with values either Strings or Arrays
Returns:
Array flattened input

Definition at line 855 of file HTMLForm.php.

Referenced by PreferencesForm::filterDataForSubmit(), HTMLSelectOrOtherField::getInputHTML(), Preferences::getOptionFromUser(), HTMLRadioField::validate(), HTMLMultiSelectField::validate(), and HTMLSelectField::validate().

HTMLFormField::getDefault (  ) 

Reimplemented in HTMLMultiSelectField.

Definition at line 827 of file HTMLForm.php.

Referenced by HTMLSelectOrOtherField::loadDataFromRequest().

HTMLFormField::getInputHTML ( value  )  [abstract]

This function must be implemented to return the HTML to generate the input object itself.

It should not implement the surrounding table cells/rows, or labels/help messages.

Parameters:
$value String the value to set the input to; eg a default text for a text input.
Returns:
String valid HTML.

Reimplemented in HTMLTextField, HTMLTextAreaField, HTMLCheckField, HTMLSelectField, HTMLSelectOrOtherField, HTMLMultiSelectField, HTMLRadioField, HTMLInfoField, HTMLHiddenField, HTMLSubmitField, HTMLEditTools, and Licenses.

HTMLFormField::getLabel (  ) 

Reimplemented in HTMLCheckField.

Definition at line 812 of file HTMLForm.php.

HTMLFormField::getLabelHtml (  ) 

Reimplemented in UploadSourceField.

Definition at line 815 of file HTMLForm.php.

HTMLFormField::getTableRow ( value  ) 

Get the complete table row for the input, including help text, labels, and whatever.

Parameters:
$value String the value to set the input to.
Returns:
String complete HTML table row.

Reimplemented in HTMLInfoField, HTMLHiddenField, HTMLSubmitField, and HTMLEditTools.

Definition at line 770 of file HTMLForm.php.

HTMLFormField::getTooltipAndAccessKey (  ) 

Returns the attributes required for the tooltip and accesskey.

Returns:
array Attributes

Definition at line 840 of file HTMLForm.php.

Referenced by HTMLSubmitField::getTableRow().

HTMLFormField::loadDataFromRequest ( request  ) 

Get the value that this input has been set to from a posted form, or the input's default value if it has not been set.

Parameters:
$request WebRequest
Returns:
String the value

Reimplemented in HTMLCheckField, HTMLSelectOrOtherField, and HTMLMultiSelectField.

Definition at line 701 of file HTMLForm.php.

HTMLFormField::needsLabel (  )  [protected]

Should this field have a label, or is there no input element with the appropriate id for the label to point to?

Returns:
bool True to output a label, false to suppress

Reimplemented in HTMLMultiSelectField, HTMLRadioField, and HTMLInfoField.

Definition at line 691 of file HTMLForm.php.

HTMLFormField::validate ( value,
alldata 
)

Override this function to add specific validation checks on the field input.

Don't forget to call parent::validate() to ensure that the user-defined callback mValidationCallback is still run

Parameters:
$value String the value the field was submitted with
$alldata $all the data collected from the form
Returns:
Mixed Bool true on success, or String error to display.

Reimplemented in HTMLFloatField, HTMLIntField, HTMLSelectField, HTMLMultiSelectField, and HTMLRadioField.

Definition at line 669 of file HTMLForm.php.


Member Data Documentation

HTMLFormField::$mDefault [protected]

Definition at line 648 of file HTMLForm.php.

HTMLFormField::$mFilterCallback [protected]

Definition at line 643 of file HTMLForm.php.

HTMLFormField::$mID [protected]

Definition at line 647 of file HTMLForm.php.

HTMLFormField::$mLabel [protected]

Definition at line 646 of file HTMLForm.php.

HTMLFormField::$mName [protected]

Definition at line 644 of file HTMLForm.php.

HTMLFormField::$mParams

Definition at line 645 of file HTMLForm.php.

HTMLFormField::$mParent

Definition at line 649 of file HTMLForm.php.

HTMLFormField::$mValidationCallback [protected]

Definition at line 642 of file HTMLForm.php.


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

Generated on Sat Apr 30 22:57:39 2011 for MediaWiki by  doxygen 1.5.9