Features
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="https://www.formbackend.com/f/{your-unique-token}" method="post"> <label>Name</label> <input type="text" name="name"> <label>Email</label> <input type="email" name="email"> <input type="submit">Submit form</input> </form>
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){{form.name}}
- 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 fieldattachments
` - 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{{value.email}}
or{{value.first_name}}
{{submission.id}}
- 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 {{value.name}}
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 {{value.email}}
.
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.
<p> {% for value in values %} <p> <strong>{{value.name}}</strong><br> {% 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 %} {{value.value}} {% endif %} </p> {% endfor %} </p>
Let’s say you want to show a list of attachments in the notification email. You can do the following: