Examples

Below are a few examples of putting the above configuration into use for real world examples.

Default Fields with Specific Recipient

{% verbatim %}<p>Contact Us!</p>

{{ form('contact')
.to('[email protected]')
.from('{email}')|raw }}{% endverbatim %}

Minimalistic Form with Custom Layout

{% verbatim %}{%  set form = form('contact')

.fields({
    'email': {
        'placeholder': 'What is your email?',
        'type': 'anomaly.field_type.email',
        'required': true
    },
    'comment': {
        'placeholder': 'What would you like to talk about?',
        'type': 'anomaly.field_type.textarea',
        'required': true
    }
})
.to('[email protected]')
.from('{email}').get %}

{{ form.open|raw }}

<div class="form-group">
    {{ form.fields.email
.input|raw }}
</div><
/span>
<div class="form-group">
    {{ form.fields.comme
nt.input|raw }}
</div><
/span>

{{ form.actions|raw }}

{{ form.close|raw }}{% endverbatim %}

Default Fields with Redirect to Thank You Page

{% verbatim %}{{ form('contact')
.redirect('thank-you')
.to('[email protected]')
.from('{email}')|raw }}{% endverbatim %}