amforms

by am-impact

am-impact / amforms

Forms plugin for Craft

125 Stars 23 Forks Last release: over 2 years ago (1.8.0) Other 343 Commits 29 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

amforms

Forms in Craft, made easy

CP functionality

When users have permission to access the plugin, they can do various stuff in the CP. There's an extra setting that'll allow users to control the plugin's settings.

Forms

You're able to activate submissions and / or notifications. This means you could choose to ignore the submissions if you want to, but only receive notifications when a form was submitted.

NewForm

Notifications are activated, and all information will be filled out by default. The Sender name and email addresses fields will automatically contain the information from your email settings in Craft's CP.

Notifications

The plugin will use it's own templates to display forms and email submissions. You have the option to override these templates in general or per form! Just create your own folder in the templates folder (e.g.: _amforms) and create a template that you would like to override. You can see the default template names in the placeholders, so if you create your own template with the same name, you could choose to make this your default templates for all your forms. When you create a template with a different name, you could create a template per form.

This tab is only available to admins.

Templates

Fields

When you install the plugin, you get some commonly used fields by default. The fields that are created are stored in a different context / scope than Craft's fields. This means that you're able to reuse these fields in any form and that they won't be shown in Craft's field list.

Fields

Export

You have the option to export your submissions per form. You'll be able to choose which fields you'd like to be included in your export (Matrix supported!). When you create an export, it'll start a task that export your submissions into a file located in your storage folder. When it's done, you're able to download the file or restart the export.

NewExport

ExportCriteria

ExportOverview

Settings

By default, the anti-spam is activated for your forms, but there's also an option to activate Google reCAPTCHA.

General

Exports

AntiSpam

reCAPTCHA

Display your forms

Simple tag

This will only display basic fields!

{{ craft.amForms.displayForm('formHandle') }}

Simple field tag

{% set form = craft.amForms.getForm('formHandle') %}

{{ form.displayField('fieldHandle') }}

Simple field tag (using a namespace)

{% set form = craft.amForms.getForm('formHandle') %}


{{ form.displayField('fieldHandle') }}

Custom HTML


    {{ getCsrfInput() }}

{# This should always be here! #}
<input type="hidden" name="action" value="amForms/submissions/saveSubmission">

{# Insert your form's handle. #}
<input type="hidden" name="handle" value="formHandle">

{# Optional: Redirect URL. Will redirect to current page by default. #}
<input type="hidden" name="redirect" value="contact?message=thankyou">

{# Optional: Anti-spam protection. #}
{{ craft.amForms.displayAntispam() }}

{# Optional: Google reCAPTCHA protection. #}
{{ craft.amForms.displayRecaptcha() }}

{# Place the HTML of your fields here #}

<input type="submit" value="Submit">

Custom HTML with displayField

{% set form = craft.amForms.getForm('formHandle') %}

{{ getCsrfInput() }}

{# This should always be here! #}
<input type="hidden" name="action" value="amForms/submissions/saveSubmission">

{# Insert your form's handle. #}
<input type="hidden" name="handle" value="{{ form.handle }}">

{# This will namespace your inputs (for IDs and such), but it's not required though #}
<input type="hidden" name="namespace" value="{{ form.getNamespace() }}">

{# Optional: Anti-spam protection. #}
{{ craft.amForms.displayAntispam() }}

{# Optional: Google reCAPTCHA protection. #}
{{ craft.amForms.displayRecaptcha() }}

{# Place the HTML of your fields here #}
{{ form.displayField('fieldHandle') }}
{{ form.displayField('aFieldHandle') }}
{{ form.displayField('anotherFieldHandle') }}

<input type="submit" value="Submit">

Custom field HTML

Change formHandle to your form's handle.

{% if formHandle is defined %} {{ errorList(formHandle.getErrors('comment')) }} {% endif %}

Custom Matrix field

{# Notify Craft which Matrix block (handle) will be inserted.
    Our field name for this example is: Persons
    Our block name for this example is: Person
#}
<input type="hidden" name="fields[persons][new1][type]" value="person">

{# Block fields #}
<label for="frm_firstname">First name</label>
<input type="text" id="frm_firstname" name="fields[persons][new1][fields][firstName]">
<label for="frm_lastname">Last name</label>
<input type="text" id="frm_lastname" name="fields[persons][new1][fields][lastName]">
{% if formHandle is defined %}
    {{ errorList(formHandle.getErrors('persons')) }}
{% endif %}

Errorlist macro

{% macro errorList(errors) %}
    {% if errors %}
        
    {% for error in errors %}
  • {{ error }}
  • {% endfor %}
{% endif %} {% endmacro %}

If you want to include it on the template itself, use:

{% from _self import errorList %}

Dashboard widget

Display your recent submissions on your dashboard.

WidgetSettings

WidgetSmall

WidgetBig

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.