m-form
Adds an AMP form to the email. All content inside the tag will only be displayed in the AMP version of the email.
Attributes
Attribute | Default Value | Description |
---|---|---|
action | create | Form submission URL. If set to “create”, the form is created when the campaign is saved in Pixcraft |
id | Form ID | |
on | submit-success: AMP.setState({formId: true}) | AMP event handler. If this value is set or auto-generated, the m-form element's ID will replace formId |
data-title | Defines the form name when saving in Pixcraft |
Usage Example
Simple text:
html
<m-form action="https://pixcraft.io/amp/post/123?key=mykey&format=json">
...
</m-form>
Notes
AMP forms require a server to handle submitted data. Pixcraft provides a backend service where you can either manually create a form or import your TJML code—forms will then be generated automatically.
To preserve your custom field names and validation rules during import, use special data attributes on input fields (input
, textarea
, select
):
html
data-required="1"
This attribute makes the field required.
You can also define the name of the form and each individual field using the data-title attribute (for m-form
, input
, textarea
, select
):
data-title="My form"