How to Use Shack Forms Variables

Shack Forms has a feature called "Variables" that allows you to customize the emails sent from your forms.

This guide will show where you can use variables, and which variables you can use.


Where can you use Variables?

There are two tabs inside Shack Forms where you can enter variables. First is the "Email" tab.

email tab

Inside the "Email" tab, you can use variables related to email addresses. Almost of the fields on this page are related to email addresses, so we recommend you insert email data. This image blelow has a typical example: if a Joomla user is logged in, it will automatically insert their email address into the "Email from" field.

email variable

The one exception on the "Email" tab is the "Email subject" field. You can use insert any variable into this field. In the image, below the {username} field will be replaced by the username of the logged in user.

ticket field

The second place you can enter variables is the "Email Template" tab. You can choose "Custom Text Message" and enter your variables. Click here to read more about customizing emails.

custom text message


Video on using Variables with Shack Forms


What Variables can you use?

Inside Shack Forms, there will be a list of variables next to your fields. You can think of these variables as being in several groups.

The first and most important group of variables allow you to show information entered into the form. Here are some examples:

  • {field_alias.value} - This displays the data from a particular field. All you need to do is replace "alias" with the alias from your field. You can find the alias inside each field. For example, you can load the data from this field by using {name.value}:

name alias

  • {field_alias.label} - This displays the visual label from a particular field. All you need to do is replace "alias" with the alias from your label. In this case, you use the {name.label} field to show "Your Name" in the message.
  • {files} - This links to uploaded files if "Attachment type" is set to "Links to files".
  • {lang:MOD_PWEBCONTACT_XXXX} - This will load a translation from ShackForms. For example, you can load the title of this field by using {lang:MOD_PWEBCONTACT_EMAIL}code>
  • {name} - This comes from the default "Name" field.
  • {email} - This comes from the default "Email" field.

email field

Some variables can also collect background information on the user. This is particularly useful if you're collecting technical information such as bug reports.

  • {sent_on} - Date and time.
  • {ip_address} - User IP address.
  • {browser} - User browser name.
  • {os} - User operating system name.
  • {user_agent} - The user agent string from the browser.
  • {screen_resolution} - The user's screen resolution.

Some variables can collect information from the page where the user enters data into Shack Forms.

  • {title} - The page title of the URL where the user submitted the form.
  • {url} - The URL where the user submitted the form.
  • {site_name} - The name of the site as set in Global Configuration.

Finally, some variables work if the user is logged in. For example, you can automatically fill in data from their Joomla user profile:

  • {username} - The Joomla's user's Username.