Web Forms
In this topic
Application
The Web Forms module can be used for:
- storing comments or queries of site visitors;
- storing and searching site visitors’ callback forms;
- processing of information in forms, etc.
Samples demonstrating search and storage of site visitors’ review forms are included in the module distribution kit.
Integration with the Statistics module allows to use the module functions to analyze the dynamics of forms filling and to acquire other information about visitors who fill in forms.
Integration with the e-Store module allows to organize sale of various goods and services by means of filling out web review forms and transferring the acquired information to the marketing module.
Functions of the web-forms module
Storing the structure of web forms (further "forms")
By using the system administrative interface, you can create the required questions and form fields.
To create a form, the following data must be specified:
- Form identifier;
- Name;
- Administrative site section menu options providing access to the result table;
- User access rights for this form (see below) and other.
You can define the templates for:
- Displaying the form;
- Displaying the result;
- Printing the result;
- Modifying the result;
- Defining a mail template designed for e-mailing the result (automatic generation of the mail templates is provided).
The statistics module maintains the facts of filling and saving the forms through the event registration mechanism. In addition, this allows to track form filling activity dynamics on days and to draw a corresponding graph. To do it, you need to specify event type identifiers for the statistics module in the form settings.
Form questions and fields
After form creation questions and fields of the form can be generated.
The form question is the collection of the question text and input fields for entering the answer to this questions.
The form field is intended for the storage of the data defined after saving the filled form (after saving the result).
To create a form question, the following data should be specified:
- Identifier;
- Whether an answer is required;
- Sorting order;
- Activity checkbox;
- Question text (including an HTML editor);
- Comment;
- Various input fields.
The following input fields are available:
- text (single line text);
- textarea (multi line text);
- multiselect (multiple selection);
- dropdown (single selection);
- Radio buttons set (single choice – alternative);
- checkbox buttons set (multiply choice);
- Fields for the file input;
- Fields for the date with built-in calendar input.
In addition, you can specify the following:
- Necessity to display answers to this question in the result table;
- Parameters and fields of a table filtering by this question.
The following filter fields types are available:
- single line text field;
- range of numbers;
- range of dates;
- single choice dropdown list.
To create a field, specify its identifier, sorting order, heading, service comment and type:
- text;
- integer;
- date.
You can also specify the following:
- Necessity to display the data stored in this field in the result table. You can optionally specify whether it's required to display in the filter field for filtering the results by the values stored in this field or not. The filter fields will be selected according to the field type:
- text type complies with the single line filter text field;
- integer type complies with the range of numbers;
- date - type complies with the range of dates;
Single line filter text allows to use logical expressions. The logical expressions syntax is:
- & (logical AND);
- | (logical OR);
- ~ (logical negation);
- () - parentheses for conditions grouping.
Logical operation priorities in filter fields are identical to the ones in mathematic.
Displaying forms
To display a form, a standard all-purpose template default.php or personal unique template implementing the required logic (for example, by means of JavaScript) can be used.
Storing, displaying, filtering and modifying the data collected by forms
The result is the collection of data collected in the forms and saved in the database. To display the collected results in the public sections of the site, the module API can be used along with samples provided in the distribution kit. The module core is implementing the form results display in the administrative site. You can filter the result fields, form questions and sort result fields when displaying the form results.
- Result ID;
- Result creation date;
- Result modification date;
- Result creator ID;
- Visitor ID and Session ID, when the result was created (allow to track the visitors’ behavior through the statistics module and obtain additional information about this visitor);
- Result status.
E-mailing filled forms
To e-mail the form results, a special mail template must be specified in the form
settings. The Create link in the mail template field generates a mail
template. Upon filling and saving the form you can use the CForm::Mail
function
(included in the module API) for sending the data via e-mail.
Assigning user rights to various actions on the forms and form results
The module supports the following access rights types for each form. Each subsequent access right type includes all the previous ones.
Access right | Description |
---|---|
Access denied | Form and its results are totally inaccessible. |
Form filling | Visitor can only fill in and save the form. |
Work with the result according to its status | Visitor can operate only with the results according to the rights set for each status. |
Work with all the results according to their statuses | Visitor can operate with all the results according to the rights set for each status. |
Viewing the form parameters | Visitor gains the opportunity to view web-form parameters. |
Full access | Includes all the above-described rights and also the rights to modify the form settings. |
Each form result must have a definite status (for example: accepted to consideration, published, draft and so on). On each web-form you can define the personal statuses set allowing to organize for each result the specific functions of workflow. In the status settings, you can define access rights both for various user groups and for the result creator. There are four actions types for which you can define access rights:
- The right to view the results in the current status;
- The right to edit the results in the current status;
- The right to delete the results in the current status;
- The right to assign the current status.
To assign access rights in web form module, complete the following:
- Assign the access level for the entire web-form.
- Create the list of statuses for the web-form results.
- Define access rights for each status.