Help:Page forms: Difference between revisions
(start to build from https://www.mediawiki.org/wiki/Extension:Page_Forms/Input_types) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Page Forms | Page Forms is an extension to MediaWiki that allows users to add, edit and query data using forms | ||
==The input types== | |||
===text=== | ===text=== | ||
The default input type; corresponds to the HTML "text" input. | The default input type; corresponds to the HTML "text" input. | ||
''Special parameters:'' | |||
'' | |||
{| class="wikitable | {| class="wikitable | ||
| <code>size= | | <code>size= ''size''</code> | ||
| <!--T:5--> Specifies the width of the input, in characters. | | <!--T:5--> Specifies the width of the input, in characters. | ||
|- | |- | ||
| <code>maxlength= | | <code>maxlength= ''maximum length''</code> | ||
| <!--T:6--> Specifies the maximum allowed length of the input. | | <!--T:6--> Specifies the maximum allowed length of the input. | ||
|- | |- | ||
| <code>placeholder= | | <code>placeholder= ''placeholder text''</code> | ||
| <!--T:7--> Specifies help text that is displayed in the input until the user clicks on it. | | <!--T:7--> Specifies help text that is displayed in the input until the user clicks on it. | ||
|- | |- | ||
| <code>autocapitalize='' | | <code>autocapitalize='' value''</code> | ||
| <!--T:336--> the | | <!--T:336--> the [https://developer.mozilla.org/docs/Web/HTML/Global_attributes/autocapitalize autocapitalize]</> parameter in the corresponding HTML tag to whatever value is set for this parameter; examples include <code>on</code>, <code>off</code>, <code>sentences</code></>, etc. | ||
|} | |} | ||
===textarea=== | ===textarea=== | ||
Corresponds to the HTML {{tag|textarea|open}} tag. | |||
Corresponds to the HTML | |||
'' | ''Special parameters:'' | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 49: | Line 44: | ||
| <code>editor=<!--T:282--> ''editor type''</code> | | <code>editor=<!--T:282--> ''editor type''</code> | ||
| <!--T:15--> Adds a JavaScript-based editor to the textarea to make editing its contents more user-friendly. The following values are supported: | | <!--T:15--> Adds a JavaScript-based editor to the textarea to make editing its contents more user-friendly. The following values are supported: | ||
:* <code>wikieditor</code> - <!--T:16--> uses the | :* <code>wikieditor</code> - <!--T:16--> uses the {{ll|Extension:WikiEditor|WikiEditor}}</> extension, which must be installed. <!--T:17--> Unfortunately, only one input within the form can have WikiEditor associated with it, due to a limitation in the WikiEditor extension. <!--T:18--> If you want to add any additional {{ll|Extension:WikiEditor/Toolbar_customization|custom toolbars}}</> to WikiEditor, you will need to add them in the JavaScript to <code>('#free_text').wikiEditor</code></>, just as they exist for < name=3><code>('#wpTextbox1').wikiEditor</code></>. | ||
::<!--T:330--> Note that there was a change to the WikiEditor code in the version that corresponds to MediaWiki version 1.34 that broke this functionality. <!--T:331--> It was restored in the 1.36 version of WikiEditor, with a corresponding change in version 5.1 of Page Forms. <!--T:332--> If you are using a version somewhere in the middle for WikiEditor, and you don't want to upgrade MediaWiki, you can manually apply the necessary change to the code, which can be found [< | ::<!--T:330--> Note that there was a change to the WikiEditor code in the version that corresponds to MediaWiki version 1.34 that broke this functionality. <!--T:331--> It was restored in the 1.36 version of WikiEditor, with a corresponding change in version 5.1 of Page Forms. <!--T:332--> If you are using a version somewhere in the middle for WikiEditor, and you don't want to upgrade MediaWiki, you can manually apply the necessary change to the code, which can be found [< name="url">https://github.com/Nikerabbit/mediawiki-extensions-WikiEditor/commit/9a1188d0850418d8ae64bd06b7f39d9a8cbf127f</> here]. <!--T:333--> You should also upgrade to version 5.1 or later of Page Forms if you are using an older versions; or you can apply the Page Forms patch [< name="url">https://github.com/Nikerabbit/mediawiki-extensions-PageForms/commit/41e69bbe6928ac2a85aae6a23c7be009511fcbcb</> here]. | ||
:* <code>tinymce</code> - <!--T:19--> uses the | :* <code>tinymce</code> - <!--T:19--> uses the {{ll|Extension:TinyMCE|TinyMCE}}</> extension, which must be installed. <!--T:334--> This does not work with multiple-instance templates. | ||
:* <code>visualeditor</code> - <!--T:20--> uses the | :* <code>visualeditor</code> - <!--T:20--> uses the {{ll|Extension:VisualEditor|VisualEditor}}</> extension, which must be installed. Another extension, {{ll|Extension:VEForAll|VEForAll}}</>, must also be installed. <!--T:24--> If you would like the toolbar to show up at the top of the edit field rather than at the bottom (default) you will also have to add <code>|class=toolbarOnTop</code></> | ||
|- | |- | ||
| <code>max height=<!--T:283--> ''maximum height''</code> | | <code>max height=<!--T:283--> ''maximum height''</code> | ||
| <!--T:21--> If VisualEditor is being used, specifies a maximum height (in pixels) for the textarea, since VE uses autogrow. <!--T:329--> The default value for this is set by the variable | | <!--T:21--> If VisualEditor is being used, specifies a maximum height (in pixels) for the textarea, since VE uses autogrow. <!--T:329--> The default value for this is set by the variable <code>$wgPageFormsVisualEditorMaxHeight</code></>, which by default is {{formatnum:400}}</>. | ||
|- | |- | ||
| <code>placeholder=<!--T:284--> ''placeholder text''</code> | | <code>placeholder=<!--T:284--> ''placeholder text''</code> | ||
Line 65: | Line 60: | ||
===text with autocomplete, textarea with autocomplete=== <!--T:23--> | ===text with autocomplete, textarea with autocomplete=== <!--T:23--> | ||
These were formerly real input types, but have been aliases for "combobox" or "tokens" (depending on whether the input holds a list of values, or just one) since version 5.0. | |||
===combobox=== | ===combobox=== | ||
The "combobox" input type provides a [[w:Combo box|combo box]] interface: an input that functions like a regular autocomplete field, but has an additional down-arrow icon, like that of a dropdown, to let the user see all the available values at once. | |||
It is implemented using the {{ll|OOUI}}</> library. | |||
''Special parameters:'' | ''Special parameters:'' | ||
Line 94: | Line 85: | ||
===tokens=== | ===tokens=== | ||
This input type "tokenizes" the values in the field, i.e puts a block around each value to make it a single unit instead of just a string of characters. | |||
These "tokens" can then also be rearranged. | |||
This input is implemented using the [< name=url>https://select2.github.io/</> Select2] JavaScript library. | |||
''Special parameters:'' | ''Special parameters:'' | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 120: | Line 109: | ||
<!--T:47--> By default, "tokens" appears as a single-row input, then expands vertically if necessary as more values are added. | <!--T:47--> By default, "tokens" appears as a single-row input, then expands vertically if necessary as more values are added. | ||
<!--T:48--> In some cases, you may want this input to appear taller than one row when it starts out, to make it clearer to users that it will expand. | <!--T:48--> In some cases, you may want this input to appear taller than one row when it starts out, to make it clearer to users that it will expand. | ||
<!--T:49--> To do that for a single input, add a | <!--T:49--> To do that for a single input, add a <code>class</code></> parameter to the field tag, like "<code>|class=''ClassName''</code></>", then add something like the following to < name=3>MediaWiki:Common.css</>: | ||
<syntaxhighlight lang="css"> | <syntaxhighlight lang="css"> | ||
Line 130: | Line 119: | ||
<!--T:50--> | <!--T:50--> | ||
If you want this to apply to all "tokens" inputs in the wiki, add something like this to | If you want this to apply to all "tokens" inputs in the wiki, add something like this to MediaWiki:Common.css</> instead: | ||
Line 153: | Line 142: | ||
<!--T:57--> The "checkboxes" input displays checkboxes to let the user choose any number of values. | <!--T:57--> The "checkboxes" input displays checkboxes to let the user choose any number of values. | ||
<!--T:58--> If there are more than a certain number of checkboxes, "Select all" and "Select none" links will automatically appear above the set of checkboxes, allowing users to automatically check all or none of them. | <!--T:58--> If there are more than a certain number of checkboxes, "Select all" and "Select none" links will automatically appear above the set of checkboxes, allowing users to automatically check all or none of them. | ||
<!--T:59--> This number is dictated by the variable | <!--T:59--> This number is dictated by the variable <code>$wgPageFormsCheckboxesSelectAllMinimum</code></>, which by default is < name=3>{{formatnum:10}}</>, though it can be changed in LocalSettings.php</>. | ||
Line 169: | Line 158: | ||
===listbox=== | ===listbox=== | ||
<!--T:63--> The "listbox" input corresponds to the HTML | <!--T:63--> The "listbox" input corresponds to the HTML <select></> tag, with the "multiple" attribute added. | ||
<!--T:64--> It shows a vertical list of options, where the user can select any number of values. | <!--T:64--> It shows a vertical list of options, where the user can select any number of values. | ||
Line 188: | Line 177: | ||
<!--T:69--> How does this input know whether it can hold one or multiple values, and should thus display radiobuttons vs. checkboxes? It checks whether the field in the template is defined as holding a list of values (using #arraymap) or not. | <!--T:69--> How does this input know whether it can hold one or multiple values, and should thus display radiobuttons vs. checkboxes? It checks whether the field in the template is defined as holding a list of values (using #arraymap) or not. | ||
<!--T:70--> This check is not perfect, though. | <!--T:70--> This check is not perfect, though. | ||
<!--T:71--> If the tree input is showing radiobuttons instead of checkboxes, you just need to add the parameter " | <!--T:71--> If the tree input is showing radiobuttons instead of checkboxes, you just need to add the parameter "|list</>" to the field tag in the form definition, to establish that this is a list. | ||
Line 225: | Line 214: | ||
<!--T:82--> | <!--T:82--> | ||
You can see a sample form that uses this input type [< | You can see a sample form that uses this input type [< name=url>http://discoursedb.org/wiki/Form:Category_input_test</> here]. | ||
====For category names==== <!--T:83--> | ====For category names==== <!--T:83--> | ||
Line 233: | Line 222: | ||
<!--T:85--> | <!--T:85--> | ||
If the field specifies multiple categories, and the template uses | If the field specifies multiple categories, and the template uses #arraymap</> to do it, the call to #arraymap</> should look something like: | ||
Line 240: | Line 229: | ||
<!--T:86--> | <!--T:86--> | ||
...in other words, you need to specify the final "delimiter" parameter for | ...in other words, you need to specify the final "delimiter" parameter for #arraymap</>, and make it a space, blank or something similar, to avoid printing commas between the category tags. | ||
Line 254: | Line 243: | ||
{| class="wikitable" | {| class="wikitable" | ||
| <code>label=</code> | | <code>label=</code> | ||
| <!--T:89--> specifies a "label" for this checkbox, which would go into a | | <!--T:89--> specifies a "label" for this checkbox, which would go into a {{tag|label|open}}</> tag. | ||
|} | |} | ||
Line 266: | Line 255: | ||
<!--T:91--> | <!--T:91--> | ||
The " | The "datetime</>" input is similar to the "date</>" input, but includes additional entries for hours, minutes, seconds and AM/PM. | ||
<!--T:92--> | <!--T:92--> | ||
Line 280: | Line 269: | ||
<!--T:108--> | <!--T:108--> | ||
" | "year</>" is a simple text input that is used to get a year-only value for a date field. | ||
===datepicker=== | ===datepicker=== | ||
[[File:PF OOUI datepicker.png|thumb|<!--T:94--> A datepicker input with calendar opened]] | [[File:PF OOUI datepicker.png|thumb|<!--T:94--> A datepicker input with calendar opened]] | ||
<!--T:95--> " | <!--T:95--> "datepicker</>" lets the user pick a date with the help of a JavaScript-based popup calendar. | ||
''Special parameters:'' | ''Special parameters:'' | ||
Line 291: | Line 280: | ||
{| class="wikitable" | {| class="wikitable" | ||
| <code>date format=</code> | | <code>date format=</code> | ||
| <!--T:317--> sets a custom date format, used only for the input field. <!--T:318--> An example would be | | <!--T:317--> sets a custom date format, used only for the input field. <!--T:318--> An example would be <code>DD-MM-YYYY</code></>. | ||
|- | |- | ||
| <code>first date=</code> | | <code>first date=</code> | ||
Line 301: | Line 290: | ||
<!--T:321--> The starting day of the week (e.g., Saturday, Sunday or Monday) is set based on the language of the wiki; it unfortunately cannot be set independently of the language. | <!--T:321--> The starting day of the week (e.g., Saturday, Sunday or Monday) is set based on the language of the wiki; it unfortunately cannot be set independently of the language. | ||
<!--T:322--> If your wiki is in English and you would like weeks in the calendar input to start on Monday instead of Sunday (which is the default), you can do that by setting your wiki's language to be " | <!--T:322--> If your wiki is in English and you would like weeks in the calendar input to start on Monday instead of Sunday (which is the default), you can do that by setting your wiki's language to be "en-gb</>" instead of "en</>". | ||
===datetimepicker=== | ===datetimepicker=== | ||
<!--T:97--> " | <!--T:97--> "datetimepicker</>" is a JavaScript-based input type very similar to "datepicker</>", but it includes popups for selecting both the date and time. | ||
<!--T:98--> It defaults to <code>yyyy/mm/dd hh:mm</code>. | <!--T:98--> It defaults to <code>yyyy/mm/dd hh:mm</code>. | ||
<!--T:99--> Its set of parameters includes all of those " | <!--T:99--> Its set of parameters includes all of those "datepicker</>" as well as the following: | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 322: | Line 311: | ||
<!--T:103--> | <!--T:103--> | ||
The " | The "rating</>" input type displays a set of stars to let the user enter a rating. | ||
<!--T:104--> | <!--T:104--> | ||
Line 341: | Line 330: | ||
{{anchor|googlemaps|leaflet|openlayers}} | {{anchor|googlemaps|leaflet|openlayers}} | ||
===googlemaps, leaflet, openlayers=== | ===googlemaps, leaflet, openlayers=== | ||
The " | The "googlemaps", "leaflet" and "openlayers" input types let you display a map to get a coordinate value, using the < name=4>Google Maps</>, < name=5>Leaflet</> or < name=6>OpenLayers</> services, respectively. | ||
If you are using the "googlemaps" input, you may need to get a [< | If you are using the "googlemaps" input, you may need to get a [< name=url>https://developers.google.com/maps/</> Google Maps API key], then set it in LocalSettings.php</> via the <code>$wgPageFormsGoogleMapsKey</code></> setting, for the input to display. | ||
You can also optionally set these parameters for these input types: | You can also optionally set these parameters for these input types: | ||
{| class="wikitable" | {| class="wikitable" | ||
| <code>height=</code> | | <code>height=</code> | ||
| | | sets the height, in pixels, of the map. | ||
|- | |- | ||
| <code>width=</code> | | <code>width=</code> | ||
| | | sets the width, in pixels, of the map. | ||
{{Note|1=<!--T:323--> Both | {{Note|1=<!--T:323--> Both height</> and width</> are needed together to set the dimension.}} | ||
|- | |- | ||
| <code>starting bounds=</code> | | <code>starting bounds=</code> | ||
| | | takes in a pair of coordinates to set the bounds of the map displayed; this parameter only applies if the input does not have a value. (Example value for this parameter: "-20,-15;50,55".) | ||
|} | |} | ||
The "leaflet" input type also allows one additional parameter: | The "leaflet" input type also allows one additional parameter: | ||
{| class="wikitable" | {| class="wikitable" | ||
| <code>image=</code> | | <code>image=</code> | ||
| | | sets the specified image (which must be an image that was uploaded to the wiki) as the background for the map, instead of a geographical map. | ||
|} | |} | ||
All of the map inputs lets you enter an address to locate the coordinates more easily. | |||
But if the form already contains one or more fields to enter the address, then the user may have to enter it twice - once to actually store the data, and the second to locate the coordinates. | |||
To avoid users having to do this double work, you can have the address field(s) feed their values directly to the map when locating the point. | |||
You can do that using the "feeds to map=" parameter - look for "feeds to map" [[Extension:Page_Forms/Defining_forms#.27field.27_tag</>|here]]. | |||
All of these formats, by default, rely on external JavaScript code. | |||
However, you can have the "openlayers" format use local JavaScript code instead, by just installing the [[Special:MyLanguage/Extension:OpenLayers</>|OpenLayers]] extension. | |||
====Disabling==== <!--T:147--> | ====Disabling==== <!--T:147--> | ||
<!--T:109--> Note that these input types all send your wiki's data (that is, the data contained in the query results) to external services. | <!--T:109--> Note that these input types all send your wiki's data (that is, the data contained in the query results) to external services. | ||
<!--T:110--> They are the only part of the Page Forms code that sends data externally, other than [[ | <!--T:110--> They are the only part of the Page Forms code that sends data externally, other than [[Special:MyLanguage/Extension:Page_Forms/Input_types#Autocompleting_on_outside_values</>|autocompleting on outside values]], though that one requires additional configuration to run. | ||
<!--T:111--> If you have a private wiki and are very concerned about no data getting out, you may want to add the following to | <!--T:111--> If you have a private wiki and are very concerned about no data getting out, you may want to add the following to LocalSettings.php</>: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
Line 392: | Line 378: | ||
<!--T:112--> | <!--T:112--> | ||
This will disallow the use of any outside services by Page Forms - which at the moment means disabling these three input types. | This will disallow the use of any outside services by Page Forms - which at the moment means disabling these three input types. | ||
===regexp=== | ===regexp=== | ||
<!--T:113--> The " | <!--T:113--> The "regexp</>" input type is not a true input type, but rather the ability to display another input (most often "text") with additional, regular-expression-based validation. | ||
<!--T:114--> See [[ | <!--T:114--> See [[Special:MyLanguage/Extension:Page Forms/Input types/Regexp</>|here]] for a more detailed explanation of this input type and its parameters. |
Latest revision as of 01:13, 13 November 2024
Page Forms is an extension to MediaWiki that allows users to add, edit and query data using forms
The input types
text
The default input type; corresponds to the HTML "text" input.
Special parameters:
size= size
|
Specifies the width of the input, in characters. |
maxlength= maximum length
|
Specifies the maximum allowed length of the input. |
placeholder= placeholder text
|
Specifies help text that is displayed in the input until the user clicks on it. |
autocapitalize= value
|
the autocapitalize</> parameter in the corresponding HTML tag to whatever value is set for this parameter; examples include on , off , sentences </>, etc.
|
textarea
Corresponds to the HTML <textarea>
tag.
Special parameters:
rows= num rows
|
Specifies the number of rows. |
cols= num cols
|
Specifies the number of columns. |
maxlength= maximum length
|
Specifies the maximum allowed length of the input. |
autogrow
|
Sets the textarea to "auto-grow" its height to match that of its contents, so that a scrollbar won't be needed. |
editor= editor type
|
Adds a JavaScript-based editor to the textarea to make editing its contents more user-friendly. The following values are supported:
|
max height= maximum height
|
If VisualEditor is being used, specifies a maximum height (in pixels) for the textarea, since VE uses autogrow. The default value for this is set by the variable $wgPageFormsVisualEditorMaxHeight </>, which by default is 400</>.
|
placeholder= placeholder text
|
Specifies help text that is displayed in the input until the user clicks on it. |
text with autocomplete, textarea with autocomplete
These were formerly real input types, but have been aliases for "combobox" or "tokens" (depending on whether the input holds a list of values, or just one) since version 5.0.
combobox
The "combobox" input type provides a combo box interface: an input that functions like a regular autocomplete field, but has an additional down-arrow icon, like that of a dropdown, to let the user see all the available values at once.
It is implemented using the OOUI </> library.
Special parameters:
size= size
|
Specifies the width of the input, in characters. |
height= height
|
Specifies the height of the combo box, in pixels. |
existing values only
|
Disallows arbitrary values in the field. |
placeholder= placeholder text
|
Specifies help text that is displayed in the input until the user clicks on it. |
tokens
This input type "tokenizes" the values in the field, i.e puts a block around each value to make it a single unit instead of just a string of characters.
These "tokens" can then also be rearranged.
This input is implemented using the [< name=url>https://select2.github.io/</> Select2] JavaScript library.
Special parameters:
size= size
|
Specifies the width of the input, in characters. |
max values= max values
|
Specifies the maximum number of allowed values. |
existing values only
|
Disallows arbitrary values in the field. |
placeholder= placeholder text
|
Specifies help text that is displayed in the input until the user clicks on it. |
By default, "tokens" appears as a single-row input, then expands vertically if necessary as more values are added. In some cases, you may want this input to appear taller than one row when it starts out, to make it clearer to users that it will expand. To do that for a single input, add aclass
</> parameter to the field tag, like "|class=ClassName
</>", then add something like the following to < name=3>MediaWiki:Common.css</>:
.ClassName, .ClassName .select2-choices {
min-height:60px;
}
If you want this to apply to all "tokens" inputs in the wiki, add something like this to MediaWiki:Common.css</> instead:
#pfForm .select2-container-multi .select2-choices {
min-height: 60px;
}
radiobutton
The "radiobutton" input corresponds to the HTML "radio" input. It shows a set of values from which the user can only choose one.
By default, the first radiobutton value is "None", which lets the user choose a blank value. To prevent "None" from showing up, you must make the field "mandatory", as well as making one of the allowed values the field's "default=" value.
dropdown
The "dropdown" input corresponds to the HTML <select> tag. It shows a dropdown list of values, from which the user can only choose one.
checkboxes
The "checkboxes" input displays checkboxes to let the user choose any number of values.
If there are more than a certain number of checkboxes, "Select all" and "Select none" links will automatically appear above the set of checkboxes, allowing users to automatically check all or none of them.
This number is dictated by the variable $wgPageFormsCheckboxesSelectAllMinimum
</>, which by default is < name=3>10</>, though it can be changed in LocalSettings.php</>.
Special parameters:
hide select all
|
hide the "Select all" and "Select none" links for this input, regardless of the number of values |
show select all
|
display the "Select all" and "Select none" links for this input, regardless of the number of values |
listbox
The "listbox" input corresponds to the HTML <select></> tag, with the "multiple" attribute added. It shows a vertical list of options, where the user can select any number of values.
Special parameters:
size= size
|
Specifies the height of the listbox, by the number of lines shown |
tree
The "tree" input type allows for a hierarchical, tree-style input, where all the values have either radiobuttons or checkboxes next to them, depending on whether the field can hold one item or many. Values can either come from a category tree within the wiki, or be set manually within the form definition.
How does this input know whether it can hold one or multiple values, and should thus display radiobuttons vs. checkboxes? It checks whether the field in the template is defined as holding a list of values (using #arraymap) or not. This check is not perfect, though. If the tree input is showing radiobuttons instead of checkboxes, you just need to add the parameter "|list</>" to the field tag in the form definition, to establish that this is a list.
Depending on the source of the values, you need to specify one of these two additional parameters:
top category=
- sets the name of the category at the top of the "tree".structure=
- sets the entire tree structure; should use wikitext-style bullets to set the depth level.
If you use the "structure" parameter, it should look something like this:
{{{field|Location|input type=tree|structure=*Universe **Milky Way Galaxy ***Solar system **Andromeda Galaxy ...etc. }}}
You can also optionally set these parameters:
height=
- sets the height, in pixels, of the box in which the tree appears.width=
- sets the width, in pixels, of the box in which the tree appears.delimiter=
- sets the delimiter when the field can hold a list of values. Default is ','.hideroot
- hides the name of the top category.depth=
- sets the number of levels of the tree that are shown at the beginning. Default is 10.
You can see a sample form that uses this input type [< name=url>http://discoursedb.org/wiki/Form:Category_input_test</> here].
For category names
If you're using the "tree" input type to display a category tree, note that this input will print out only the names of the categories selected, without the "Category:" namespace before it; so if you want that to show up in the page as well, the template will have to add it.
If the field specifies multiple categories, and the template uses #arraymap</> to do it, the call to #arraymap</> should look something like:
{{#arraymap:{{{Categories|}}}|,|x|[[Category:x]] |<nowiki> </nowiki>}}
...in other words, you need to specify the final "delimiter" parameter for #arraymap</>, and make it a space, blank or something similar, to avoid printing commas between the category tags.
checkbox
A single checkbox, used for boolean values.
Special parameters:
label=
|
specifies a "label" for this checkbox, which would go into a <label> </> tag.
|
date
This input contains three separate entries, for the year, month and day.
datetime
The "datetime</>" input is similar to the "date</>" input, but includes additional entries for hours, minutes, seconds and AM/PM.
Special parameters:
include timezone
|
specifies that a time zone entry should also be included. |
year
"year</>" is a simple text input that is used to get a year-only value for a date field.
datepicker
"datepicker</>" lets the user pick a date with the help of a JavaScript-based popup calendar.
Special parameters:
date format=
|
sets a custom date format, used only for the input field. An example would be DD-MM-YYYY </>.
|
first date=
|
sets the first date the user is allowed to select. |
last date=
|
sets the last date the user is allowed to select. |
The starting day of the week (e.g., Saturday, Sunday or Monday) is set based on the language of the wiki; it unfortunately cannot be set independently of the language. If your wiki is in English and you would like weeks in the calendar input to start on Monday instead of Sunday (which is the default), you can do that by setting your wiki's language to be "en-gb</>" instead of "en</>".
datetimepicker
"datetimepicker</>" is a JavaScript-based input type very similar to "datepicker</>", but it includes popups for selecting both the date and time.
It defaults to yyyy/mm/dd hh:mm
.
Its set of parameters includes all of those "datepicker</>" as well as the following:
mintime=
|
the minimum allowed time |
maxtime=
|
the maximum allowed time |
interval=
|
the interval (in minutes) between options shown to the user |
rating
The "rating</>" input type displays a set of stars to let the user enter a rating.
Special parameters:
star width
|
specifies the width (and height) of each star. Default is 24px. |
num stars
|
specifies the number of stars to display. Default is 5. |
allow half stars
|
allow users to select half a star. Default is false; set to 'yes' (or any other value) to make true. |
googlemaps, leaflet, openlayers
The "googlemaps", "leaflet" and "openlayers" input types let you display a map to get a coordinate value, using the < name=4>Google Maps</>, < name=5>Leaflet</> or < name=6>OpenLayers</> services, respectively.
If you are using the "googlemaps" input, you may need to get a [< name=url>https://developers.google.com/maps/</> Google Maps API key], then set it in LocalSettings.php</> via the $wgPageFormsGoogleMapsKey
</> setting, for the input to display.
You can also optionally set these parameters for these input types:
height=
|
sets the height, in pixels, of the map. |
width=
|
sets the width, in pixels, of the map.
<span class="citation wikicite" id="endnote_Both height</> and width</> are needed together to set the dimension.">^ |
starting bounds=
|
takes in a pair of coordinates to set the bounds of the map displayed; this parameter only applies if the input does not have a value. (Example value for this parameter: "-20,-15;50,55".) |
The "leaflet" input type also allows one additional parameter:
image=
|
sets the specified image (which must be an image that was uploaded to the wiki) as the background for the map, instead of a geographical map. |
All of the map inputs lets you enter an address to locate the coordinates more easily.
But if the form already contains one or more fields to enter the address, then the user may have to enter it twice - once to actually store the data, and the second to locate the coordinates.
To avoid users having to do this double work, you can have the address field(s) feed their values directly to the map when locating the point.
You can do that using the "feeds to map=" parameter - look for "feeds to map" here.
All of these formats, by default, rely on external JavaScript code.
However, you can have the "openlayers" format use local JavaScript code instead, by just installing the [[Special:MyLanguage/Extension:OpenLayers</>|OpenLayers]] extension.
Disabling
Note that these input types all send your wiki's data (that is, the data contained in the query results) to external services. They are the only part of the Page Forms code that sends data externally, other than autocompleting on outside values, though that one requires additional configuration to run. If you have a private wiki and are very concerned about no data getting out, you may want to add the following to LocalSettings.php</>:
$wgPageFormsDisableOutsideServices = true;
This will disallow the use of any outside services by Page Forms - which at the moment means disabling these three input types.
regexp
The "regexp</>" input type is not a true input type, but rather the ability to display another input (most often "text") with additional, regular-expression-based validation. See [[Special:MyLanguage/Extension:Page Forms/Input types/Regexp</>|here]] for a more detailed explanation of this input type and its parameters.