Forms that act on their answers

Your forms can now email the right person, flag an entry and tell your team in the admin, depending on what was sent. Big quote requests no longer wait in the pile.

By Darryl Waterhouse · · 4 min read

A form on your website is only useful if the right person sees what comes in, quickly. A quote request for a big job should not sit in the same pile as a question about opening hours. Domma CMS forms can now act on their answers when they are sent: email the right person, flag the entry, and tell your team in the admin, all without anyone sorting through the inbox first.

This builds on form triggers, which already change a form as people fill it in (see Forms that react). What is new is what a form can do once it is sent.

Where to find it

Open Data > Forms, pick a form and go to its Actions tab. Two new cards sit there:

  • Tell People - a one-tick way to tell people about every submission.
  • When the Form Is Sent - triggers that belong to the whole form, rather than to one field.

An example: a quote request

Our demo company, ACME, has a Request a quote form: name, email, company, what they need, a budget and a few words about the job.

The ACME quote request form on a public page, filled in with a budget of over £2,000

ACME wants big jobs handled first. So the form has one trigger in When the Form Is Sent: when Budget equals over-2000 (the value behind the Over £2,000 choice), it does three things. Otherwise, it does one.

The When the Form Is Sent card with one trigger: Email someone, Set a field and Notify people when the budget is over £2,000, and Set a field otherwise

A trigger has a When, a Then and an Otherwise. The When can be every submission, or conditions over any of the form's fields (all of them true, or any one). Each branch takes the actions a submission can have.

The three new actions

Email someone sends the answers to the addresses in To (up to 10, commas between them). Leave Subject blank for a standard subject, or write your own. You can put answers in it: ACME's reads Big quote request from {{your_name}}, and the Insert field list beside the box picks the field for you. It goes out through your site's own email settings.

Set a field writes a value into the saved entry. The usual target is a Hidden field: the visitor never sees it, and it shows in your submissions like any other answer. ACME's form has a hidden Priority field, set to high for big budgets and normal for the rest.

A saved submission in the admin showing the answers and Priority: high

Notify people (it used to be "Notify the admins") tells people in the admin. Tick who should hear, and choose a Notification (the bell, and their For you list), a Message from the site in Messages, or both. A message carries the answers in full, line breaks included. Messages is a free Tool and needs to be switched on for this. Tick nobody and it works as before: every admin is told.

All three also work on an ordinary field trigger, so a single answer can set them off too.

Tell People: every submission, one tick

If you simply want to know about every submission, you don't need a trigger at all. Tick Tell people when the form is sent in the Tell People card, choose Notification, Message or both, and tick who should hear. Tick nobody and every admin is told.

The Tell People card with Notification ticked and Jane Carter chosen

Good to know

  • These actions run on your server after the answers have been checked. They are never written into the page, so a visitor cannot see the email addresses, the people you tell or the values you set, and cannot skip them.
  • Emails and notifications go only once the submission has been saved. If an email cannot be sent, the submission is still kept and you get a Form actions failing notice, so you can fix your email settings.
  • Set a field cannot fill in files, pictures, passwords or signatures. If two actions set the same field, the later one wins.
  • When the Form Is Sent can also run a CMS Action or redirect the visitor, as field triggers could already.

Try it

Open Data > Forms, choose a form, and go to Actions. Add a hidden Priority field on the Fields tab, then add a trigger under When the Form Is Sent that sets it when a big answer comes in. Send yourself a test submission and open it in the form's submissions to see the field filled in.

More on what forms can do is on the Forms page.