Name
_token
Type
_token
Synopsis
Token input field
Description
Use of select2 tokens
Parameters
_token
name = e.g. tokenfield[]
separator = token values have by default comma separated values when adding to a Template. You can specify a different separator using this argument . e.g. separator=";".
allowtags = (no value or (as off version 2.2.19 ->) value of 'allowtags') Allow to create values that do not exist
allowsort = (no value or (as off version 2.2.19 ->) value of 'allowsort') Allow user to sort values (drag and drop selected token). Does not work with query source.
allowclear = (no value or (as off version 2.2.19 ->) value of 'allowclear') allow user to clear his selection. Will only work when you have set a placeholder.
input-length-trigger = integer number of characters before lookup actually happens, defaults to 3
id = mandatory
query = If you have Semantic MediaWiki installed, you can do a SMW Ask query here to fill the options list.
- returntext lets you set a property for the visible label of the token
- returnid (optional) lets you set a property for the value to be stored. This defaults to the page name.
- limit (optional) lets you sets the maximum number of pages to be returned by the query
- fquery (optional) lets you set a SMW Filter query that will be added to the query. Additional you can use [fffield='<name of a form field>'] inside the fquery to dynamically add a value of a form field in the filter query.
callback = templateCallBack
multiple = multiple
Example
Example 1 : Search for pages in the Doc page types.
<form>
<_token name="tokenfield[]" id="tokener" query="[[Class::Doc]][[Title::!!!]](limit=99999)(returntext=Title)" placeholder="Search for Documentation Titles" multiple="multiple" allowclear>
</_token>
</form>
Example 2 : Select one or more cars or create a new one
<form>
<_token name="car[]" id="test-tokens-multiple" multiple="multiple" allowtags>
<input type="option" value="volvo">Volvo</input>
<input type="option" value="saab" selected="selected">Saab</input>
<input type="option" value="tesla" selected="selected">Tesla</input>
</_token>
</form>
Example 3 : using the selected and options attributes
<form>
<_token name="TestSelected[]" id="test-tokens-selected" selected="C" options="A,B,C,D,E" />
</form>
Example 4 : using fquery
<form> <select name="Version" > <input type="option" value="+">Any version</input> <input type="option" value="1.0">1.0</input> <input type="option" value="1.1">1.1</input> <input type="option" value="2.0">2.0</input> <input type="option" value="2.1">2.1</input> </select> <_token name="Doc page" id="tokens-with-fquery" query="[[Class::Doc]][[Doc subject::DevOps:Doc/FlexForm]][[Title::!!!]](limit=99999)(returntext=Title)(fquery=[[Subject version::[fffield=Version] ]])" input-length-trigger="1" placeholder="Search for Documentation Titles" multiple="multiple" allowclear> </_token> </form>
Note
In an SMW query, the !!! will be replaced with whatever the user types.