From mediawiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: unmaintained
Implementation Parser function
Description Allows to automatically fill form input fields based on the (live) input of other fields
Author(s) Simon Heimler (Fannontalk)
Latest version 0.2.0 (April 2015)
MediaWiki 1.19+
PHP 5.2+
Database changes No
License MIT License

Check usage and version matrix.

The AutoFillFormField extension allows to automatically fill form input fields provided by the Semantic Forms extension based on the (live) input of other fields.


In some situations, choosing the correct page name is difficult, since there are many possibilities how to do it. This leads to inconsistencies, duplicated pages etc. This extension is an attempt to solve this problem when using Semantic Forms in edit mode.

It allows to define a field that holds the final page URL, providing a pattern how to build it. This pattern can create references to other fields, whose in-put values will be incorporated while typing. 


This extension requires Semantic MediaWiki and Semantic Forms to be installed first.

  • Download and place the file(s) in a directory called AutoFillFormField in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/AutoFillFormField/AutoFillFormField.php";
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Instead of downloading the tarball you may also check this extension out via Git: git clone https://github.com/Fannon/AutoFillFormField.git


AutoFillFormField is triggered by applying certain CSS classes to fields in your Semantic Form.

Target Field[edit]

First you have to define the target field by applying the AutoFillFormFieldTarget class to it. The field also needs to declare how the URL / name is built. This is done by adding a second class starting with URL: followed by a string that declares how the field value needs to be built.

This string supports variables and substitutions. Variables are encapsulated in ? signs, like ?variable?.

Currently the following substitutions are supported:

  • ___ to (space). This is important because you can't add spaces to a classname.
  • FULLPAGENAME will be substituted by the current full pagename.


  • |class=AutoFillFormFieldTarget URL:?strasse?,___?plz?___?ort?
  • |class=AutoFillFormFieldTarget URL:FULLPAGENAME/?ip?

Source Fields[edit]

A source field is defined by adding the class AutoFillFormFieldSource and the variablename prefixed by source_. Example: source_country.

Every field that is referenced by a ?variable? needs a corresponding source_target.

Complete Example[edit]

Semantic Form Markup[edit]

The important parts are marked in bold.

{{{for template|HeimarbeitsplatzAdresse|heimarbeitsplatz|label=heimarbeitsplatz|multiple|minimum instances=0}}}
  {| class="formtable"
  ! Heimarbeitsplatz:
  | {{{field|heimarbeitsplatz|size=none|class=AutoFillFormFieldTarget URL:?strasse?,___?plz?___?ort?|input type=text|list|delimiter=;|default=}}}
  ! Straße:
  | {{{field|strasse|size=none|class=AutoFillFormFieldSource source_strasse|input type=text|mandatory}}}
  ! Postleitzahl:
  | {{{field|plz|size=none|class=AutoFillFormFieldSource source_plz|input type=text|mandatory}}}
  ! Ort:
  | {{{field|ort|size=none|class=AutoFillFormFieldSource source_ort|input type=text|mandatory}}}
  ! Land:
  | {{{field|land|size=none|class=AutoFillFormFieldSource source_land|input type=dropdown|mandatory|default=DE|values from namespace=Land|existing values only}}}
  {{{end template}}}


This is how the code above will look look / behave: