Manual:HTMLForm Tutorial

 is a powerful and easy helper to build forms within MediaWiki.

This tutorial will help  developers to get started with HTMLForm.

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

The rest of this page is about the basics of creating a generic special page extension called MyForm.

This is not directly related to this tutorial, but 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 and later. 

HTMLForm classes are locatedat  .

The code is pretty clean and well-documented enough, that should make MW Hackers happy.

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

Your SpecialPage's front-end code can be at:

This previous file enclosing both View/Controller, the Model (main file of your extension) can be at:

The  files can be found in the folder:

Then .hooks, .alias... etc.

LocalSettings.php
Do not forget to install your extension by adding:  .

When using 1>Special:MyLanguage/Manual:Extension registration|extension registration, use  </> instead.

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.