Extension:CIForms/zh

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, multi-step, 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)

安装

 * 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 multi-step & 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)

New features (1.3.1)

 * xlsx/excel export of form data
 * fixed js module loading
 * better support for WIKIs localized in other languages than English
 * adaptive visualization of required symbols when no labels or placeholders are set
 * form data headings now match the field/label names rather than generic input names (see this picture for a reference)
 * more robust processing of form data following changes on the form descriptor (i.e. in previous versions a change of a label of a field could have made the data entered with the old label not accessible, this is now solved provided that the input type remains the same)
 * new api to ensure that the extension is updated to the latest available version

例子


基础样式（一列）
这是最简单的表单样式，（默认类型为“输入”，一列）

方括号表示输入，方括号内可以指定输入类型（如最大输入字数等），加入星号代表此项为必填字段

将会产生如下输出：



(working example)

--

占位符
包含“占位符”的表单 方括号内包含占位符和等号后面的可选输入类型:

将会产生如下输出：



(working example)

--



两列
输入响应式布局(两列)，方括号包含输入类型，表单行可以包含html(电子邮件输入的标签是粗体)



(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, 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)

attention: in order for this example to work, and must be set respectively to  and to an high value (for instance 10000) in your LocalSettings.php, and Template:Countries must exist



(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)

--

Multi-step & pagination
Since version 1.3 (July 2022) CIForms supports the creation of multi-step forms, 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, use the  parameter combined with form sections (see above).

In order to convert the previous form in a multi-step form, add
 * paging = 2

to the form descriptor. Each step will contain 2 sections. You can set the number of sections for each step using a value like the following:  (this will display 1 section in the first 2 steps, and 2 in the last one)

Here is a complete working example https://wikisphere.org/wiki/CIForms_multi-step



the demo tries to emulate the full list of inputs offered by LimeSurvey however, although CIForms provides native validation whenever possible, it currently misses some input types, specifically the QArray* inputs and conditional display.

---

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 on 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.

Features request
Do you need a specific solution fitting your requirements or those of your customers? Fill-in this form and I'll get back to you quickly with a quote.



(click the image to open the form)