Manual:HTMLForm Tutorial

is a powerful and easy helper to build forms within MediaWiki. This tutorial will help developers to get started with.

(HTMLForm being a front-end helper, it's assumed that you are developing a front-end extension. ie: a )

The rest of this page is about the basics of creating a generic SpecialPage Extension called MyForm. This is not directly related to this tutorial, but I guess it won't hurt to show how the extension should look like. At the bottom of the page the Special:MyForm displays "Hello World".

Otherwise, let's get started...

Files and environment

 * This explanation applies to MediaWiki version 1.23 or thereabouts.

HTMLForm Classes are at /mediawiki/includes/HTMLForm.php Code is pretty clean and well-documented enough, that should make MW Hackers happy.

Your SpecialPage is in an extension called MyForm. You'll call it by accessing: Special:MyForm

Your SpecialPage's front-end code can be at: /mediawiki/extensions/MyForm/MyForm_body.php This previous file enclosing both View/Controller, the Model (main file of your extension) can be at: /mediawiki/extensions/MyForm/MyForm.php The files can be found in the folder: /mediawiki/extensions/MyForm/i18n Before MediaWiki 1.25, the i18n file could be found in: /mediawiki/extensions/MyForm/MyForm.i18n.php Then .hooks, .alias...

LocalSettings.php
Do not forget to install your extension by adding: require_once( "$IP/extensions/MyForm/MyForm.php" );

MyForm.i18n.php
This file will hold all the messages used within your form. Be careful with the messages' IDs, they will be specified later in this tutorial.

MyForm_body.php
Finally, the file that interests us the most

NEXT PAGE OF THE TUTORIAL