Working With MediaWiki
autocomplete, combobox, textarea, textarea with autocomplete
Text
textarea
5 x 30
text
Code
textarea
5 x 30
text
URL
text
100
textarea
Number
text
10
textarea
Date
date
datetime (holds additional fields for the time), year (simply a text input)
Enumeration
dropdown
radiobutton
Boolean
checkbox
dropdown, radiobutton
And here are the default and other allowed input types for delimited lists of a certain data type, enabled by the use of the “#arraymap” function in the template:
Data type
Default input type
Default size
Other allowed input types
Page
text with autocomplete
100
text, textarea, textarea with autocomplete, categories, checkboxes
String
text
100
text with autocomplete, textarea, textarea with autocomplete
Enumeration
checkboxes
listbox
In addition, several other extensions define additional form input types, most notably Semantic Maps and Semantic Forms Inputs. We’ll get to those in subsequent chapters.
Autocompletion
One of the big strengths of Semantic Forms is that it supports autocompletion — you can enable a field to show a dropdown list of possible completions when the user starts typing.
If a field represents a semantic property of type “Page”, autocompletion will be enabled by default — the field will autocomplete on the names of all pages that are already pointed to by that property. For fields representing a semantic property of type “String”, there is no default autocompletion, but you can achieve this same effect simply by adding "
input type=text with autocomplete
" or "
input type=textarea with autocomplete
" to the field’s definition. You can also autocomplete on other sets of values:
to autocomplete on all the values of a specific property, add "
values from property= property-name
" to the field definition
to autocomplete on the names of all pages in a category, add "
values from category= category-name
"
to autocomplete on the names of all pages in a namespace (like “File”), add "
values from namespace= namespace-name
" (if you want to autocomplete on the main namespace, use "
values from namespace=Main
", or just "
values from namespace=
").
finally, you can autocomplete based on the values in an external URL; which lets you get autocompletion values from essentially any outside system. See “Autocompleting on outside values”, below, for how to do this.
If a field is specified to hold multiple values (see below), autocompletion will, by default, support multiple values: after a value is entered, and a delimiter placed, a new autocompletion will start for the next value. You can manually specify that a field should have multiple-value autocompletion, by adding the "list" parameter to the field’s definition. You can also specify the delimiter for this list of values, using the "delimiter=..." parameter (the default is a comma).
The set of a field’s possible values for autocompletion is, by default, contained right within the form’s HTML page, in a JavaScript declaration. For performance reasons, there is a limit to how many values can be placed in the page; this number is defined by the variable $sfgMaxAutocompleteValues, which by default is set to 1000. If you have more than this number of possible values for a field, you should probably use remote autocompletion instead, where autocompletion happens through an Ajax call to the server, based on what the user has typed. This type of autocompletion is slower, but always returns a comprehensive set of results. You can enable this by adding the "remote autocompletion" parameter to the field’s definition.
By default, Semantic Forms autocompletion matches on the beginning of every word in the set of possible values. However, you can change autocompletion to instead match on every character, by adding the following line to LocalSettings.php:
$sfgAutocompleteOnAllChars = true;
This feature is especially important for wikis that have values with non-ASCII characters, such as wikis in languages with non-Roman alphabets; since the default, word-based autocompletion doesn’t yet work with non-ASCII characters.
Finally, you can disable autocompletion, if it’s enabled by default for a field, by setting the input type to be simply "text" or "textarea".
Combo box input
For any input that holds a single value, you can set the input to be a combo box by setting "input type=combobox" in the field definition. This input functions like a regular autocomplete field, but has an additional down-arrow icon,
Weitere Kostenlose Bücher