Using macros with forms
When configuring forms, you can set values dynamically using macro expressions. Forms support only basic macro expressions, typically of the following types:
Macros that retrieve values from other various types of advanced contexts may not resolve correctly when the form is submitted by a visitor on the live site.
Form data macros
When configuring a form, you can use values from the context of the specific form data submitted by the user. This can be achieved using macros in the {%field_name%} format. The field_name part of the macro is the Name of a particular form field, as shown on the Form builder tab (not the Label value displayed next to the field in the actual form). When the form is submitted, the macros are automatically resolved and replaced with data from the form.
These macros can be used in the following text fields:
- General tab
- Display text
- Redirect to URL
- Email notifications
- Sender email
- Recipient emails
- Subject
- Email body
- Autoresponder emails
- From email
- Subject
- Email body
Example 1
When configuring notification emails for a form, you may use the following values:
- Subject: Form submitted by {%FirstName%} {%LastName%}
FirstName and LastName are the names of fields in the form. As a result, the notification email subjects will contain the first and last name submitted by the user in the related form record.
Example 2
If you enter the Display text value on the General tab of the form like this:
- Dear {%FirstName%}, thank you for your message. We will contact you shortly.
The text will be resolved as the following when “Jane” was entered in the First name field by the user:
- Dear Jane, thank you for your message. We will contact you shortly.
Form text localization
If you need to display the form on a multilingual website, you can localize field captions and other text strings using localization macros, for example:
- {$myform.fullname$}
- {$=Hello|de-de=Hallo|it-it=Ciao$}
To learn more, see: