CAFE values in forms
Write {cafe:field_name} wherever Gravity Forms accepts merge tags:
- Confirmations: "Thanks! We see you at {cafe:venue}."
- Notifications: subject and message.
- HTML fields inside the form.
- Default value of a field, to prefill it. A hidden field with the
default value
{cafe:event_code}sends the event code of the page along with every entry.
You don't have to remember names: the merge tag menu (the {..} button)
lists every CAFE field under Custom, as "CAFE: Group › Field".
Which value is shown
| The field belongs to a group shown on | The merge tag shows |
|---|---|
| Posts, pages or custom post types | The value of the page the form is on |
| A Settings Page | The site-wide value (in the current language with WPML) |
For notifications and confirmations "the page the form is on" is the page the entry was sent from (Gravity Forms stores it with the entry).
Fields of groups shown only on user profiles or terms have no page to read from, so they are not offered as merge tags.
Prefilling a field
Put the merge tag in the field's Default Value (Field settings → Advanced). When the form is shown, the field starts with the CAFE value of the page.
| Use | Field | Default value |
|---|---|---|
| Send the event along with every sign-up | Hidden | {cafe:event_code} |
| Suggest the usual quantity | Number | {cafe:default_seats} |
| Show the venue (read only) | Single Line Text, read only through CSS or a plugin | {cafe:venue} |
What the value looks like
Merge tags show text that people can read:
| Field type | Shows |
|---|---|
| Select, Radio, Checkbox, Button Group | The labels of the chosen options ("Large", not "l"), joined by commas |
| Toggle | Its On / Off text, or Yes / No |
| Post Object, Relationship, Page Link, Taxonomy, User | Titles and names, joined by commas |
| Rich Text | Plain text, paragraphs on their own lines |
| Link | The link text |
| Google Map | The address |
| Text, Textarea, Number, Email, URL, Date, Time, Color | The value as returned by cafe_get_field() |
Gravity Forms decides the escaping: values are escaped for HTML in messages and URL-encoded in redirect links.
Image, File, Gallery, Collection and Section Builder fields are not offered as merge tags.
When a merge tag stays empty
- The field does not exist, is a sub-field (inside a Collection) or is a Password field. Passwords are never shown, not even when you type their name or key yourself.
- The field belongs to posts, but the form is not on a post. In the form editor and Preview, people who can edit forms see the values of the page the form is placed on; when the form is on no page yet, the tag stays empty there.
- The page is not public (a draft, a private post or a post with a password) and the visitor cannot edit it.
Two fields with the same name
When two field groups have a field with the same name, the menu lists the
second one by its key, for example {cafe:field_6f2a9c}. Both forms work:
{cafe:venue} uses the first group, the key always means that one field.