MediaWiki  REL1_24
HTMLAutoCompleteSelectField Class Reference

Text field for selecting a value from a large list of possible values, with auto-completion and optionally with a select dropdown for selecting common options. More...

Inheritance diagram for HTMLAutoCompleteSelectField:
Collaboration diagram for HTMLAutoCompleteSelectField:

List of all members.

Public Member Functions

 __construct ($params)
 Initialise the object.
 getAttributes (array $list)
 Returns the given attributes from the parameters.
 getInputHTML ($value)
 This function must be implemented to return the HTML to generate the input object itself.
 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.
 validate ($value, $alldata)
 Override this function to add specific validation checks on the field input.

Protected Attributes

 $autocomplete = array()

Detailed Description

Text field for selecting a value from a large list of possible values, with auto-completion and optionally with a select dropdown for selecting common options.

If one of 'options-messages', 'options', or 'options-message' is provided and non-empty, the select dropdown will be shown. An 'other' key will be appended using message 'htmlform-selectorother-other' if not already present.

Besides the parameters recognized by HTMLTextField, the following are recognized: options-messages - As for HTMLSelectField options - As for HTMLSelectField options-message - As for HTMLSelectField autocomplete - Associative array mapping display text to values. autocomplete-messages - Like autocomplete, but keys are message names. require-match - Boolean, if true the value must be in the options or the autocomplete. other-message - Message to use instead of htmlform-selectorother-other for the 'other' message. other - Raw text to use for the 'other' message

Definition at line 27 of file HTMLAutoCompleteSelectField.php.


Constructor & Destructor Documentation

Initialise the object.

Parameters:
array$paramsAssociative Array. See HTMLForm doc for syntax.
Since:
1.22 The 'label' attribute no longer accepts raw HTML, use 'label-raw' instead
Exceptions:
MWException

Reimplemented from HTMLFormField.

Definition at line 30 of file HTMLAutoCompleteSelectField.php.

References $key, $params, $value, array(), as, HTMLFormField\getOptions(), HTMLFormField\msg(), and wfMessage().


Member Function Documentation

Returns the given attributes from the parameters.

Parameters:
array$listList of attributes to get
Returns:
array Attributes

Reimplemented from HTMLFormField.

Definition at line 101 of file HTMLAutoCompleteSelectField.php.

References $attribs, array(), FormatJson\encode(), and HTMLFormField\getOptions().

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:
string$valueThe value to set the input to; eg a default text for a text input.
Returns:
string Valid HTML.

Reimplemented from HTMLTextField.

Definition at line 116 of file HTMLAutoCompleteSelectField.php.

References $key, $ret, $value, array(), empty, HTMLFormField\flattenOptions(), and HTMLFormField\getOptions().

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:
WebRequest$request
Returns:
string The value

Reimplemented from HTMLFormField.

Definition at line 64 of file HTMLAutoCompleteSelectField.php.

References HTMLFormField\getDefault().

HTMLAutoCompleteSelectField::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:
string | array$valueThe value the field was submitted with
array$alldataThe data collected from the form
Returns:
bool|string True on success, or String error to display, or false to fail validation without displaying an error.

Reimplemented from HTMLFormField.

Definition at line 81 of file HTMLAutoCompleteSelectField.php.

References $value, HTMLFormField\flattenOptions(), HTMLFormField\getOptions(), and HTMLFormField\msg().


Member Data Documentation

HTMLAutoCompleteSelectField::$autocomplete = array() [protected]

Definition at line 28 of file HTMLAutoCompleteSelectField.php.


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