Token input field


Use of select2 tokens



name = e.g. tokenfield[]

allowtags = (no value) Allow to create values that do not exist

allowsort = allow user to sort values (drag and drop selected token). Does not work with query source.

allowclear = allow user to clear his selection (for json ajax calls)

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 1 : Search for pages in the Doc page types.

<_token name="tokenfield[]" id="tokener" query="[[Class::Doc]][[Title::!!!]](limit=99999)(returntext=Title)" placeholder="Search for Documentation Titles" multiple="multiple" allowclear>


In an SMW query, the !!! will be replaced with whatever the user types.