mmx/forms

Modern forms for MODX 3

1.7.0 2024-11-21 02:31 UTC

This package is auto-updated.

Last update: 2024-11-21 02:34:20 UTC


README

This extra is part of MMX initiative - the Modern MODX approach.

The Vueform integration to build and process any kind of forms.

Features

  • Convenient way to create forms in manager by specifying the schema.
  • You can use free Vueform Builder to generate a form and export ready schema.
  • Optional sending of emails to any amount of addresses with custom chunks.
  • 3 types of action on form submission: reset, redirect and show custom message.
  • All form submissions and emails are saved in database.

Dependencies

This package requires mmxDatabase to work with MODX database using Eloquent models.

The mmx/database dependency will be downloaded automatically by Composer.

Prepare

This package can be installed only with Composer.

If you are still not using Composer with MODX 3, just download the composer.json of your version:

cd /to/modx/root/
wget https://raw.githubusercontent.com/modxcms/revolution/v3.0.4-pl/composer.json

Then run composer update and you are ready to install the mmx packages.

Install

composer require mmx/forms --update-no-dev
composer exec mmx-forms install

Update

composer update mmx/forms --no-dev
composer exec mmx-forms install

Changes will be described on repository Releases page. Don't forget to subscribe for updates!

Remove

composer exec mmx-forms remove
composer remove mmx/forms

How to use

  1. Create new forms in /manager/?a=home&namespace=mmx-forms section.
  2. Call the mmxForms snippet on any MODX page with id of form:
[[!mmxForms?id=`1`]]

Snippet should only be called without caching!

  1. Enjoy!

Styling

Snippet will load built-in CSS based on Bootstrap 5 by default. You can disable this behaviour by noCSS param.

[[!mmxForms?id=`1`&noCSS=`1`]]

Better way is to change the CSS variables, for example:

<style>
.mmx-forms * {
    --vf-primary: red !important;
}
</style>

You can see which variables are used by the form and change them.

Nota bene!

Project is still under development, do not hesitate to use issues if you have any.