Extension:InputBox

The InputBox extension is a MediaWiki extension that adds already created HTML forms to wiki pages. Users can "complete" a form (entering text, selecting menu items, etc.) by entering text into the box.

InputBox was originally created by Erik Möller for the purpose of adding a Create an article box to Wikinews. Extension:InputBox requires at least MediaWiki 1.5.

Installation
1. Create the folder InputBox in the extensions folder.

2. Download from the Extension Distributor, and extract the files to the extensions/InputBox/ folder of your MediaWiki installation.


 * The most recent version of InputBox.php does not work on older MediaWiki installations.

3. In LocalSettings.php add the following line with the other "require_once" lines:

Example
This kind was found on the main page of a Wikipedia. It could be used for starting new articles, since it doesn’t go to the edit box of articles that already exist.

General syntax
InputBoxes are constructed like this:

The type parameter is mandatory. All other parameters are optional.

Parameters
Applying create &#160;to an existing page simply gives the edit page. In that case preload is ignored. Applying comment &#160;for a new page works.

The texts taken from the MediaWiki: namespace are of course only examples, any existing page can be used for editintro or preload. Unfortunately preload does not yet work for the Special:Upload summary.

Please note that variables, templates, parser functions and template parameters are not supported in InputBox parameters.

Alignment enhancement
If there is a need to define alignment each time an input box is used, one option is to just remove the div tag from the input box HTML and specify the div when posting the InputBox. A more versatile option would be to add the following code which allows changing the alignment in the options. By installing this modified copy of the code then you can specify align=left</tt>, align=center</tt>, or align=right</tt>. Caution! The linked code is from Feb.2007. There have been bug fixes and feature additions to both MediaWiki and InputBox since that time. You may need to test for compatibility and functionality.

Using InputBox in a template
In order to create many similar input boxes, InputBox can be used in a template. However, passing template parameters to InputBox parameters only works if the  </tt> tag is written as   </tt> inside the template.

The following example is a template to create a new wiki page from a named template:

When instantiating the template, the first parameter gives the item that is created (default: article</tt>) as spelled out in the button, the second parameter gives the name of the template used to create the item (default: Template:Article</tt>).

E.g., the code for an input box to create a new project from a project template might look like this:

Known bugs

 * 5210 – and tags are not respected from a preloaded template. fixed in MediaWiki r63194 Parser.php, Edit.php on 3 March 2010 v1.17?
 * 11777 – Multiple InputBoxes make page invalid due to repetitive similar id. Fixed in MediaWiki r60072 InputBox.classes.php on 15 December 2009
 * 6640 – Prefix option for InputBox. Fixed in MediaWiki r63922 InputBox.hooks.php, InputBox.classes.php, InputBox.php 18 March 2010
 * 13909 – Trying to 'indent' an input box breaks the formatting on the rest of the page.
 * 13834 – Too much formatting!
 * 28019 – when type=commenttitle and page=Special:MyPage, the heading entered in the text box is lost.