TractorCow\AutoComplete\AutoCompleteField
Autocompleting text field, using jQuery.
Synopsis
class AutoCompleteField
extends TextField
{
- // members
- private static array $allowed_actions = ;
- private $sourceClass;
- private array $sourceFields = ;
- private $sourceFilter;
- private string $sourceSort = 'ID ASC';
- protected $suggestURL;
- protected integer $limit = 10;
- protected integer $minSearchLength = 2;
- protected bool $requireSelection = true;
- protected string $displayField = 'Title';
- protected string $labelField = 'Title';
- protected string $storedField = 'ID';
- protected bool $populateSeparately = false;
- protected bool $clearInput = true;
- // methods
- public void __construct()
- public array getAttributes()
- public string Type()
- public string Field()
- public string Value()
- public AutoCompleteField setSourceClass()
- public string getSourceClass()
- public AutoCompleteField setSourceFields()
- public array|string getSourceFields()
- public AutoCompleteField setDisplayField()
- public string getDisplayField()
- public AutoCompleteField setLabelField()
- public string getLabelField()
- public AutoCompleteField setStoredField()
- public string getStoredField()
- public AutoCompleteField setSourceFilter()
- public string getSourceFilter()
- public AutoCompleteField setSourceSort()
- public string getSourceSort()
- public AutoCompleteField setSuggestURL()
- public AutoCompleteField setLimit()
- public int getLimit()
- public AutoCompleteField setMinSearchLength()
- public int getMinSearchLength()
- public AutoCompleteField setRequireSelection()
- public bool getRequireSelection()
- public string getSuggestURL()
- public AutoCompleteField setPopulateSeparately()
- public bool getPopulateSeparately()
- public AutoCompleteField setClearInput()
- public bool getClearInput()
- protected null|string determineSourceClass()
- public string Suggest()
Hierarchy
Extends
- SilverStripe\Forms\TextField
Members
private
- $allowed_actions — array
- $sourceClass
—
string
Name of the class this field searches. - $sourceFields
—
string
Name of the field to use as a filter for searches and results. - $sourceFilter
—
string
Constant SQL condition used to filter out search results. - $sourceSort
—
string
Constant SQL clause to sort results.
protected
- $clearInput
—
TractorCow\AutoComplete\bool
Clears the search input field field when a selection has been made. - $displayField
—
string
The field or method used to identify the results. - $labelField
—
string
The field or method used for the display of the result in the listing - $limit
—
int
Maximum number of search results to display per search. - $minSearchLength
—
int
Minimum number of characters that a search will act on. - $populateSeparately
—
TractorCow\AutoComplete\bool
Indicate if results (when selected) should be populated underneath the text field instead of inside of the text field. - $requireSelection
—
TractorCow\AutoComplete\bool
Flag indicating whether a selection must be made from the existing list. - $storedField
—
string
The field to store in the database. - $suggestURL
—
string
The url to use as the live search source.
Methods
protected
public
- __construct()
- Field()
- Suggest() — Handle a request for an Autocomplete list.
- Type()
- Value() — Gets the readable value of the record, per $displayField.
- getAttributes()
- getClearInput()
- getDisplayField() — Get the field or method that should label the results.
- getLabelField() — Get the field or method that should label the results.
- getLimit()
- getMinSearchLength()
- getPopulateSeparately()
- getRequireSelection()
- getSourceClass() — Get the class which is used for Autocomplete suggestions.
- getSourceFields() — Get the field which is used for Autocomplete suggestions.
- getSourceFilter() — Get the filter used for Autocomplete suggestions.
- getSourceSort() — Get the sort used for Autocomplete suggestions.
- getStoredField() — Get the field that should store in the database
- getSuggestURL() — Get the URL used to fetch Autocomplete suggestions.
- setClearInput()
- setDisplayField() — Set the field or method that should label the results.
- setLabelField() — Set the field or method that should label the results.
- setLimit()
- setMinSearchLength()
- setPopulateSeparately()
- setRequireSelection()
- setSourceClass() — Set the class from which to get Autocomplete suggestions.
- setSourceFields() — Set the field from which to get Autocomplete suggestions.
- setSourceFilter() — Set the filter used to get Autocomplete suggestions.
- setSourceSort() — Set the sort used to get Autocomplete suggestions.
- setStoredField() — Set the field that should store in the database.
- setSuggestURL() — Set the URL used to fetch Autocomplete suggestions.