Extension:CIForms

CIForms is a complete solution to quickly create input forms to immediately retrieve data from visitors, and they include a wide range of features, like native validation, nested sections, multiple choice questions with arbitrary inputs within lines and supporting all standard list style types, cloze tests, Google recaptcha, select & combobox, textarea with maxlength, data access (used to restrict the access to forms' submissions), and much more!

Forms submissions are both optionally sent as a pdf document to the provided email address(es), and stored in a dedicated table which can be accessed by permitted users through a Special Page. (from which each submission can be individually downloaded as a pdf document as well)

Installation

 * Download and place the file(s) in a directory called  in your   folder.
 * Run  inside the folder   (this will install the dependencies phpmailer and dompdf required to send the pdf with form results to a given email address, or to download the form results as pdf)
 * Add the following code at the bottom of your LocalSettings.php
 * Run  (this will install the required tables)
 * ✅ – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

New features (1.3)

 * csv export of form data
 * support for steps & pagination
 * new local and global parameters  and   (in order to redirect the user on a page of the wiki once submission)
 * updated list of global and local parameters, with back-compatibility
 * support for postgres and table prefix
 * username always saved in form data
 * editable labels for buttons (submit, navigation back and next)

Basic, one column
This is the simplest form (type "inputs" by default, one column)

The square brackets represent an input, the square brackets optionally contain the input type, the asterisk indicates a mandatory field

which produces the following



(working example)

--

Placeholders
Form with placeholders. The square brackets contain the placeholder and optionally the input type after the equal symbol:

which produces the following:



(working example)

--

Two columns
Inputs responsive (two columns), the square brackets contain the input type, the form rows can contain html (the label of the email input is bold)



(working example)

--

Multiple choice
Multiple choice with arbitrary text inputs between answers (on the last line in the example). By default the input will be rendered as radio buttons (only one answer allowed). In order to display checkboxes allowing multiple answers just set the parameter  to a value greater than 1.



(working example)

--

Select
Select with placeholder and hardcoded options. Options contain commas ? Just escape them!



(working example)

--

Select with combobox
Select populated by wikitext (if the select contains more than 20 options CIForms will automatically display it as a select2 combobox)



(working example)

--

Nested sections
Form with nested sections. The multiple choice accepts up to 3 answers ("max answers=3") The textarea has a maxlength attribute ("[textarea=1000]")



(working example)

--

Pagination
Since version 1.3 (July 2022) CIForms supports the creation of surveys, simply by splitting form sections in steps or pages, rather than displaying them, as by default, altogether. In order to have a form consisting of several steps, just use the  parameters combined with form sections (see above).

---

Cloze test
Cloze tests are mainly used to administer quizzes and tests.

Square brackets represent an input, a square bracket with text inside represents a suggestion. The asterisk represents an example sentence. Each row can contain an arbitrary number of inputs.



(working example)

Cloze test with suggestions
The list of suggestions is automatically shuffled and the inline suggestion is automatically canceled from the list. (line-through)



(working example)

... and more! check here for more examples!!

Special Page/Output
CIForms stores all the submissions in a table and all the available forms can be viewed and navigated through a special page, and even downloaded as pdf. Additionally, form results can be sent to a provided email address, as explained below.

This is a screenshot of the special page Submissions, with the list of form's submissions, grouped by title and the page where the form is placed, throughout the Wiki:



This is the list of submissions to a given form. The list can be navigated, and if the relevant dependencies are installed (see above, ), the form data can be immediately downloaded as pdf.



---

Pdf output
This is an example pdf output of the form above "Job application", either received by email if the parameter  is used (see section below for more detail) or clicking the download button in the submissions table.

open pdf

Configuration
Note that in order to be able to send email to the provided email address (usually the system administrator) on form submissions,  must be enabled, and PHPMailer must be installed as per  istructions.

Insert the following code after  in LocalSettings.php (this facilitates setting the global variables listed below)

The constants above indicate the "merging strategy" of the global variable in relation to the corresponding parameter set within the form. means that the global variable will be used only if the corresponding local variable (placed in the form descriptor) is null,  means the global variable will override the local, and   means that the two will be merged together.

Global parameters

None of the following options are required, if  (global) or   (local) are null, form data will be accessible only to sysops. If  (global) or   (local) are null, form data will not be dispatched by email.

Global to local parameters

Parameters
The following parameters can be used in the parser function  or

Support & bugs
Please report the error messages in the Talk page of the extension. Updates will be posted on the main MediaWiki mailing list mediawiki-l so we advice you to subscribe to the list to stay tuned with them.