FormBackend logo


Merge tags

Use merge tags to personalize notifictions, referencing values submitted via the form

When you create a form using Formbackend, you have the option to send the person that submits your form an email. For that to work, you need to have an email field in your form. Let’s take the following form markup as an example (ABCDEF should be your unique identifier for your form):

<form action="{your-unique-token}" method="post">
  <input type="text" name="name">

  <input type="email" name="email">

  <input type="submit">Submit form</input>

Available values

You can reference values from either your form or the submitter entries by using a placeholder {{..}} where .. is one of the following values:

Form values

  • {{form.token}} - the token for the form (the one you use in the URL you submit to)
  • {{}} - the name of your form
  • {{form.url}} - the URL of your form

Submission values

  • {{timestamp}} - the time the form was submitted
  • {{values}}` - an array of the form values. Where each value has the following:
    • name` - the name of the form field (i.e. first_name)
    • value` - the value of the field (i.e. John)
    • is_attachment` - true or false based on if it was a file field
    • attachments` - an array of files that might have been uploaded for a file field. Each attachment has the following: filename, url, size
  • {{value}} - a specific value from the form, could be {{}} or {{value.first_name}}
  • {{}} - the ID of the submission
  • {{submission.url}} - the link to the page with the submission values (requires login)
  • {{submission.submitted_from}} - the URL of the page the submission was submitted from

Configuring notifications

Go to the “notifications” tab for your form, and scroll down to the “Notify the person who submits the form” section. Make sure to click on the radio-button “Send them an email when they submit the form”. You should now see “From email”, “From name”, “Subject” and “Body”.

The “From email” is the email from where the emails should be sent, this can be your companys email or your own personal email depending on your use case.

“From name” is the name the email should show up from when they receive it.

“Subject” is the emails subject.

“Body” is the content of the email. You could write a simple “Thank you! We’ll get back to you shortly” message, or you can use merge tags to personalize it further.

Merge tags are written on the form {{}} which will be replaced by the value the submitter put in the name field - or in the case of the above example you could also do {{}}.

When you start typing `{{` you should see an auto-suggest menu appear in which you can select any of the available fields.

Showing a list of submitted values

To show a list of submitted values, we can use the values value. This will give us an array of values. We can iterate over those by using {% for value in values %}. We can then check if the value if an attachent and if it is we will display a link to downlad the given attachment, if not then we’ll just show the value.

  {% for value in values %}
      {% if value.is_attachment %}
        {% for attachment in value.attachments %}
          <a href="{{attachment.url}}" class="attachment-link">{{attachment.filename}}</a> <span class="attachment-metadata">{{attachment.size}}B</span><br>
        {% endfor %}
      {% else %}
      {% endif %}
  {% endfor %}

Let’s say you want to show a list of attachments in the notification email. You can do the following: