Docs /Wrangler

Custom fields

Ask for more than a subject and a message — an order number, a product, a website address — without touching the database. Define the fields in Settings → Custom fields, one per line:

order_number | Order number | required
product      | Which product? | select | required | Tent, Stove, Pack
website      | Your website
contact      | Best email to reach you | email
details      | Anything else? | textarea

The handle comes first. It names the input and the stored value, and may use lowercase letters, numbers and underscores. The label comes second. After that, in any order:

Word Means
text A one-line answer. The default.
textarea A longer answer.
email Must be an email address.
select One of a fixed list; give the options separated by commas. A field with options and no type is a select.
required The ticket is refused until it is answered.

A line starting with # is ignored.

On the form

The sample submit form renders every defined field automatically, in order, with the visitor's answers kept after a rejected submission. In your own template, use the {custom_fields} pair inside {exp:wrangler:submit_form}:

{custom_fields}
    <label for="{field_id}">{field_label}</label>
    {if is_select}
        <select id="{field_id}" name="{field_name}">
            <option value="">Choose one…</option>
            {options}<option value="{option}"{if is_selected} selected{/if}>{option}</option>{/options}
        </select>
    {if:elseif is_textarea}
        <textarea id="{field_id}" name="{field_name}">{field_value}</textarea>
    {if:else}
        <input id="{field_id}" type="text" name="{field_name}" value="{field_value}">
    {/if}
{/custom_fields}
Variable Value
{field_handle} The handle.
{field_name} The input name to use, fields[handle].
{field_id} A ready-made id, wr-field-handle.
{field_label} The label.
{field_value} The answer from a rejected attempt, for sticky values.
{field_type} text, textarea, email or select.
{if is_text} {if is_textarea} {if is_email} {if is_select} The type, as conditionals.
{if is_required} Whether it must be answered.
{options} For a select: a pair with {option} and {if is_selected}.

{if has_custom_fields} is true when any field is defined.

Answers are checked on the server: a missing required answer, an option that is not in the list and a bad email address each send the visitor back with a message naming the field.

Where the answers appear

  • On the ticket page in the control panel, under their labels in the header.
  • In the new-ticket staff alert, as {custom_fields}. If your saved alert template does not contain {custom_fields}, the answers are added to the end of it.
  • In the CSV export, one column per field.
  • On the customer's ticket page, with the {custom_fields} pair inside {exp:wrangler:ticket} ({field_label}, {field_value}), or one answer at a time as {field:handle}.

Changing fields later

Answers are stored on each ticket under the handle. Renaming a label changes how old answers are shown; renaming a handle leaves old answers under the old handle, where they show in the control panel by their raw name. Removing a field hides nothing that was already answered.

The older meta:something inputs still work alongside custom fields. They are stored the same way, but with no label, type or validation.