Use this template to create forms that can create new pages or add content to existing pages.

Parameters[edit source]

General[edit source]

The following parameters control the general behavior of the form:

  • templateRequired! Name of the template that will process and format the submitted data. If you don't want to use a template (or if you want to use several templates) then you can create a template meant to be substituted (example) and set subst:Your template as the value of this parameter.
  • page — Name of the page where the data will be posted. If the page doesn't exist, it will be created. If the page exists, the data will be appended. If omitted, the current page will be used. If the given page name contains a string like "{{{x}}}", it will be replaced with the value of the field named "x". This allows to build page names dynamically by combining predefined text and field values.
  • section — Name of the section where the data will be posted. If the section doesn't exist, it will be created. If the section exists, the data will be appended. If omitted, the data will be appended to the page. If the given section name contains a string like "{{{x}}}", it will be replaced with the value of the field named "x". This allows to build section names dynamically by combining predefined text and field values.
  • redirect — Set this to any value to redirect the user to the page (and section) where the data was posted. If omitted, then a success message defined by submit-success (see below) will be shown instead.
  • group — User group that is allowed to fill out the form, for example 'user' or 'sysop'. If omitted, then all user groups are allowed.

Fields[edit source]

The following parameters control the form fields:

  • fieldN (replacing N for a number from 0 to 99) — Name of the field. This will also be the name of the parameter fed to the template. If you want to use anonymous parameters, just name them using numbers (e.g. field1 = 1). If no fields are defined, then the template will be injected with no parameters.
  • fieldN-label — Label of the field.
  • fieldN-value — Default value of the field.
  • fieldN-placeholder — Placeholder of the field.
  • fieldN-help — Help text of the field.
  • fieldN-required — Whether the field is required. Any value means yes.
  • fieldN-disabled — Whether to disable the field. Any value means yes.
  • fieldN-type — Type of the field. Supported values are:
    • text — Use it for plain text inputs. This is the default field type. Use fieldN-suggestions to suggest some values.
    • page — Use it for page title inputs. The form will suggest existing titles as the user types. Use fieldN-namespace and fieldN-category to limit the titles suggested.
    • textarea — Use it for multi-line text inputs.
    • location — Use it for location inputs. The form will suggest locations as the user types, using Open Street Map's Nominatim service.
    • number — Use it for number inputs. Use fieldN-min and fieldN-max to limit the allowed numbers.
    • dropdown — Use it for dropdown menus. Use fieldN-options to set the allowed options. If fieldN-required is not set, then an additional empty option will be included, using fieldN-placeholder as the label.
    • radio — Use it for radio select inputs. Use fieldN-options to set the allowed options. If fieldN-required is not set, then an additional empty option will be included, using fieldN-placeholder as the label.
    • boolean — Use it for boolean inputs. Boolean inputs render as a single checkbox. If the checkbox is checked, then the value of fieldN-value will be posted, or "1" if no value is set. If the checkbox is not checked, then no value will be posted. Use fieldN-selected to control the initial state of the checkbox.
    • hidden — Use it for hidden inputs.
  • fieldN-suggestions — Comma-separated list of values to suggest for "text" fields.
  • fieldN-namespaceNamespace number of the namespace from where to suggest titles for "page" fields.
  • fieldN-category — Category name (without the "Category:" prefix) from where to suggest titles for "page" fields.
  • fieldN-min — Minimum value for "number" fields.
  • fieldN-max — Maximum value for "number" fields.
  • fieldN-options — Comma-separated list of options for "dropdown" or "radio" fields.
  • fieldN-selected — Initial state for "boolean" fields.

Messages[edit source]

The following parameters control the form messages:

  • submit — Text of the submit button. Default is "Submit".
  • submit-success — Text to show when the data is successfully submitted. Default is "The form was submitted, thanks!"
  • submit-error — Text to show if an unknown error occurs when submitting the data. Default is "Something went wrong, sorry!"
  • template-error — Text to show if the required template parameter is not set. Default is "The template parameter is required."
  • namespace-error — Text to show if a form is submitted in the Template namespace. Default is "Forms don't work in the Template namespace."
  • group-error — Text to show if the group parameter is set but the user is not part of the group. Default is "This form is restricted to the '$1' group."

Examples[edit source]

Simple[edit source]

The following form would inject a call to Template:Contact at the bottom of Appropedia:Village pump:

{{Form
| template = Contact
| page = Appropedia:Village pump
| field1 = name
| field1-label = Your name
| field2 = text
| field2-label = Your message
| field2-type = textarea
| field2-required = required
}}
Loading...

Advanced[edit source]

The following form would inject a call to Template:Contact at the bottom of the talk page of the page entered in the first field, under the section entered in the second field, and the user would then be redirected to it:

{{Form
| template = Contact
| page = Talk:{{{page}}}
| section = {{{topic}}}
| redirect = yes
| field1 = page
| field1-label = Page
| field1-type = page
| field2 = topic
| field2-label = Topic
| field3 = name
| field3-label = Name
| field4 = address
| field4-label = Location
| field4-type = location
| field5 = text
| field5-label = Message
| field5-type = textarea
| field5-required = required
| field6 = terms
| field6-label = I accept the terms and conditions
| field6-type = boolean
| field6-required = required
}}
Loading...

See also[edit source]


Cookies help us deliver our services. By using our services, you agree to our use of cookies.