k (1 revision imported) |
(Imported by PageSync) Label: wsps-content-edit-tag |
||
Regel 5: | Regel 5: | ||
<pre> | <pre> | ||
{{Csp formfield/token | {{Csp formfield/token | ||
|name= (text) | |name= (text) | ||
|id= (optional html id) defaults to id based on the "name" parameter | |||
|multiple= (optional: "multiple") to allow selecting multiple values | |multiple= (optional: "multiple") to allow selecting multiple values | ||
|required= (optional: "required") | |required= (optional: "required") | ||
|value= (value(s) from "allowedValues" list) selected values, e.g. "A,C" | |value= (value(s) from "allowedValues" list) selected values, e.g. "A,C" | ||
|allowedValues= (comma-separated values) value options, e.g. "A,B,C,D,E" | |allowedValues= (comma-separated values) value options, e.g. "A,B,C,D,E" | ||
|allowtags= (optional: "allowtags") | |||
}} | }} | ||
</pre> | </pre> | ||
Regel 15: | Regel 17: | ||
== Example == | == Example == | ||
{{Csp formfield/token | {{Csp formfield/token | ||
|name=Broodje1 | |name=Broodje1() | ||
|id=token-broodje1 | |||
|value=kroket | |value=kroket | ||
|allowedValues=braadworst,gezond,kroket | |allowedValues=braadworst,gezond,kroket | ||
Regel 37: | Regel 40: | ||
// NOTE: empty placeholder is used because allowclear required a placeholder (else there will be no way to clear filled fields when not using "multiple") | // NOTE: empty placeholder is used because allowclear required a placeholder (else there will be no way to clear filled fields when not using "multiple") | ||
--><_token | --><_token | ||
id="token-{{lc:{{anchorencode:{{{name|}}} }} }}" | id="{{#if:{{{id|}}} |{{{id|}}} |token-{{lc:{{anchorencode:{{{name|}}} }} }} }}" | ||
name="{{{name|}}}[]" | name="{{{name|}}}[]" | ||
class="form-control" | class="form-control" | ||
Regel 45: | Regel 48: | ||
options="{{#invoke:CspFunctions|preprocess|_content={{{allowedValues|}}} }}" | options="{{#invoke:CspFunctions|preprocess|_content={{{allowedValues|}}} }}" | ||
placeholder="" | placeholder="" | ||
allowclear | allowclear="allowclear" | ||
allowsort | allowsort="allowsort" | ||
allowtags="{{{allowtags|no}}}" | |||
/></includeonly> | /></includeonly> | ||
ws-base-props | |||
---|---|---|---|
Regel 2: | Regel 2: | ||
|Class=Application page | |Class=Application page | ||
|Title=Template:Csp formfield/token | |Title=Template:Csp formfield/token | ||
|Version history={{Version history item | |||
|Version number=1.1 | |||
|Version description=Added "allowtags" parameter | |||
|Version date=2024-8-12 10:14:53 | |||
}}{{Version history item | |||
|Version number=1.0 | |||
|Version description=added optional id parameter because some ids cause issues with attaching select2 token js to the formfield | |||
|Version date=2024-7-31 11:41:08 | |||
}} | |||
}} | |||
}} | |||
}} | }} |
Huidige versie van 24 mrt 2025 om 09:29
This is the Csp formfield/token template. It should be called in the following format:
{{Csp formfield/token |name= (text) |id= (optional html id) defaults to id based on the "name" parameter |multiple= (optional: "multiple") to allow selecting multiple values |required= (optional: "required") |value= (value(s) from "allowedValues" list) selected values, e.g. "A,C" |allowedValues= (comma-separated values) value options, e.g. "A,B,C,D,E" |allowtags= (optional: "allowtags") }}
Example
Related templates: