(Imported by PageSync) Tag: wsps-content-edit-tag |
(Imported by PageSync) Tag: wsps-content-edit-tag |
||
| Line 6: | Line 6: | ||
{{Csp formfield/ask token | {{Csp formfield/ask token | ||
|name= (text) | |name= (text) | ||
|id= (optional html id) defaults to id based on the "name" parameter | |||
|placeholder= (optional: text) | |||
|multiple= (optional: "multiple") to allow selecting multiple values | |multiple= (optional: "multiple") to allow selecting multiple values | ||
|required= (optional: "required") | |required= (optional: "required") | ||
|value= (comma- | |value= (comma-separated pagenames) selected values, e.g. "Template:Add version history item,Module:VersionHistoryItems" | ||
|allowedValues= (SMW query) e.g. "[[Class::Application page]]" | |allowedValues= (SMW query) e.g. "[[Class::Application page]]" | ||
}} | }} | ||
| Line 15: | Line 17: | ||
== Example == | == Example == | ||
{{Csp formfield/ask token | {{Csp formfield/ask token | ||
|name= | |name=Page | ||
|placeholder=Search application pages | |||
|value= | |value= | ||
|multiple=multiple | |multiple=multiple | ||
| Line 29: | Line 32: | ||
</noinclude><includeonly><_token | </noinclude><includeonly><_token | ||
id=" | id="{{#if:{{{id|}}} |{{{id|}}} |token{{#invoke:CspFunctions|gmatch|{{{name|}}}|([%w]+)|}} }}" | ||
name="{{{name|}}}[]" | name="{{{name|}}}[]" | ||
class="form-control" | class="form-control" | ||
| Line 36: | Line 39: | ||
input-length-trigger="1" | input-length-trigger="1" | ||
query="{{{allowedValues|}}}[[Title::!!!]](limit=999)(returntext=Title)" | query="{{{allowedValues|}}}[[Title::!!!]](limit=999)(returntext=Title)" | ||
placeholder="" | placeholder="{{{placeholder|}}}" | ||
allowclear | allowclear | ||
><!-- | ><!-- | ||
// NOTE: placeholder is | // NOTE: placeholder is mandatory because allowclear won't work without it (else there will be no way to clear filled fields when not using "multiple") | ||
// loop over value parameter using arrayfunctions to create selected options | // loop over value parameter using arrayfunctions to create selected options | ||
| ws-base-props | |||
|---|---|---|---|
| Line 2: | Line 2: | ||
|Class=Application page | |Class=Application page | ||
|Title=Template:Csp formfield/ask token | |Title=Template:Csp formfield/ask token | ||
|Version history={{Version history item | |||
|Version number=1.2 | |||
|Version description=Added placeholder parameter (#171) | |||
|Version date=2025-6-30 12:54:10 | |||
}}{{Version history item | |||
|Version number=1.1 | |||
|Version description=changed default id to only contain alphanumeric characters (#197) | |||
|Version date=2025-4-02 12:52:06 | |||
}}{{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-30 08:15:02 | |||
}} | |||
}} | |||
}} | |||
}} | |||
}} | }} | ||
Latest revision as of 08:01, 18 September 2025
This is the Csp formfield/ask token template. It should be called in the following format:
{{Csp formfield/ask token
|name= (text)
|id= (optional html id) defaults to id based on the "name" parameter
|placeholder= (optional: text)
|multiple= (optional: "multiple") to allow selecting multiple values
|required= (optional: "required")
|value= (comma-separated pagenames) selected values, e.g. "Template:Add version history item,Module:VersionHistoryItems"
|allowedValues= (SMW query) e.g. "[[Class::Application page]]"
}}
Example
Related templates: