Jump to main content Jump to doc navigation

FormitFastPack

Other versions: 3.x — Found a problem? Please edit this page or report an issue.

What is FormitFastPack?

FFP simplifies the management of HTML associated with form-processing snippets like FormIt and Login.

Installation

Install from the MODX package manager.

Getting Started

Below is a simple example of using the field snippet with a FormIt form. For a more detailed example, check out the Tutorial.

[[!FormIt?
 &hooks=`email,redirect`
 &emailTpl=`ContactFormReport`
 &emailTo=`[[++emailsender]]`
 &emailSubject=`New contact form submission`
 &validate=`email:email:required,message:required`
 &redirectTo=`1`
]]
<form action="[[~[[*id]]]]" method="post">
[[!field? &type=`text` &name=`email` &req=`1`]]
[[!field? &type=`textarea` &name=`message` &class=`cleardefault` &req=`1`]]
[[!field? &type=`submit` &name=`submitForm` &label=` ` &message=`Send this Message!`]]
</form>

Included Snippets

field: One snippet call generates the HTML for a single form field. The HTML for all fields of a single design can be managed with only two chunks (one outer and one inner), and dynamic values such as the current field value and error messages are processed correctly. Selective caching speeds up option processing.

fieldSetDefaults: This snippet outputs nothing, but any parameters passed to it will change the default value for all subsequently-processed field snippets. This method of setting defaults will not work if a property set is used with the field snippet.

fieldPropSetExample: This is a dummy snippet that holds a complete property set for the "field" snippet. Because property sets cannot work with fieldSetDefaults, the field snippet does not come with a property set. This property set is provided for those who prefer to use property sets over fieldSetDefaults.

fiGenerateReport: A FormIt hook which generates an email report by iterating all field submitted names and values through a row template chunk.

fiProcessArrays: A FormIt hook which transforms array values into concatenated strings. Later versions of FormIt now provide similar functionality.

formCollectErrors (coming soon): Outputs a list of form errors.

Automatic Labels

By naming your fields properly, you can use FFP's method of generating labels from field names. Alternatively, you can manually specify labels.

The labels are generated using simple output filters that can be customized: [[+name:replace=_== :ucwords]]

Example results:

Field Name Generated Label
name Name
first_name First Name
company_address Company Address
number_of_employees Number Of Employees

Support