FormitFastPack - Form Tools for MODX Revolution

Please note: I have shifted my focus to Python/ Linux/ embedded development and am no longer accepting MODX or PHP projects. For MODX work, I recommend Grey Sky Media.

FormitFastPack is a MODX Revolution extra available in the MODX Repository.

FeaturesIntroduction and ExamplesDocumentation


Form Field Templating:
  • Compatible with FormIt, Login, and other form-utilizing extras.
  • Generate selects, checkboxes, and radio button lists.
  • Custom field types, parameters, and templates.
  • Template all forms of the same design with only two chunks.
  • Dozens of options allow enormous flexibility
  • Default and example chunks get you going right away.
  • Generate entire forms in your own components through $modx->runSnippet('field',$params_array).
Helper Snippets:
  • Quickly set and reset defaults for subsequent field snippets with the fieldSetDefaults snippet.
  • FormCollectErrors allows you to output a list of all form errors.
Email Reports:
  • Automatically parses all submitted fields into an email report.
  • Use only one email report template for all forms.
  • Template report output rows.
  • Optional ability to template array field output.
FormIt Wrapper - coming soon:
  • Check that POST only contains fields from the original form.
  • JSON output
  • Automatically generate the &validate FormIt parameter from field snippet &validate parameters.

Introduction and Examples

The field snippet generates an HTML form field and surrounding HTML, complete with the current value and error placeholders set by FormIt and similar snippets. See all field parameters. See all field template placeholders.

[[!fieldSetDefaults? &prefix=`myprefix.` &resetDefaults=`1`]]
[[!field &name=`full_name` &type=`text` &class=`required`]]
[[!field? &name=`email` &req=`1` &tpl=`aDifferentTemplate` &outer_tpl=`ADifferentOuterTpl`]]
[[!field &name=`message` &type=`textarea`]]
[[!field &name=`favorite_color` &type=`checkbox` &options=`Blue||Red||Yellow`]]
[[!field? &type=`radio` &req=`1` &name=`color` &label=`Your Favorite Color:` &default=`` &options=`Red==red||Blue==blue||Other==default`]]
[[!field? &type=`select` &default=`1` &name=`country_id` &label=`Country:` &options_element=`optionsCountries`]]
[[!field? &type=`select` &name=`favorite_things` &multiple=`1` &array=`1` &options=`MODx==modx||Cats and Kittens==felines||World Domination==power`]]
[[!field &name=`submitForm` &type=`submit` &label=` ` &message=`Submit Form`]]

To avoid managing dozens of chunks for each field type, each template chunk contains the template code for all types, delimited by special HTML comments. Use the default templates or make your own by copying them into chunks.

  • fieldTypesTpl chunk: Contains templates for each field type.
    • Each field type template is surrounded by <-- type --> before and after, where 'type' is the field type.
    • Each field snippet's type is set with the &type parameter (defaults to 'text').
    • You can change the field types chunk used for a field snippet with the &tpl parameter.
  • fieldWrapTpl chunk: Contains templates for each outer field type.
    • Each outer type template is surrounded by <-- outer_type --> before and after, where 'outer_type' is the outer field type.
    • Each field snippet's type is set with the &outer_type parameter (defaults to 'default').
    • You can change the outer type chunk used for a field snippet with the &outer_tpl parameter.
The fiGenerateReport snippet is a formIt hook that automatically generates a placeholder of all submitted form fields and values. For human-readable labels, separate the words in your field names with underscores (which will be converted to spaces in the report).
  • Optionally use fiProcessArrays for processing array fields (may not be necessary in newer versions of FormIt).
  • Call FormIt as usual, except add fiProcessArrays,fiGenerateReport as hooks before the email hook.
  • In your emailTpl chunk, use the [[+figr_values]] placeholder to output all fields and values detected in the POST.
  • Field names are made human-readable in the report row template (which defaults to 'fieldReportRow') by capitalizing and replacing underscores with spaces:
    <p><strong>[[+field:replace=`_== `:ucwords]]:</strong> [[+value:nl2br]]</p>
  • Use FormIt parameter &figrTpl to change the report row template.


See the official documentation at