Creating form templates

:bookmark: This guide explains how to use form templates for structuring content in Discourse.

:person_raising_hand: Required user level: Administrator

Form templates let you create structured forms with validation rules that users can fill out when creating topics so you can ensure users provide all the information you want or need to support them, such as for bug reports, feature requests, etc.

Note: For templates that function more like guidelines instead of a structured form, consider using topic templates.

Enabling form templates

You can turn on form templates in Upcoming changes by setting Enable form templates to โ€œEveryoneโ€.

Creating form templates

You can create and manage form templates by going to Admin > Appearance > Form templates (/admin/customize/form-templates).

To create a form template:

  1. Click New Template.

  1. Update the Template Name field with an internal name for your template.

  2. Use the buttons at the top of the page to the various fields on your form and update the field attributes (detailed below). Many of the options are standard form field types (e.g., checkbox, short answer, dropdown, etc.), but there are a few specific fields:

    • Tag Group selector: Users can select one or more tags from a particular group.

    • Markdown answer: Users can add content directly into a mini-version of the composer. This is ideal for when members need to input Markdown directly, such as code, or need other formatting supported by the rich editor.

  3. Add any desired validations to your inputs. Click the Validation button for a key (also displayed below).

  4. Click the Preview button to make sure everything looks right.

  5. Click Save.

Field attributes

Common attributes for all field types:

  • label: The visible field name
  • placeholder: Helper text shown in empty fields (input, textarea, dropdown, multi-select)
  • description: Additional context or instructions displayed below the field.

Upload-specific attributes:

  • file_types: Comma-separated list of allowed file extensions (e.g., .jpg, .png, .pdf)
  • allow_multiple: Boolean indicating whether users can upload multiple files

Dropdown and multi-select attributes:

  • none_label: Text shown when no option is selected
  • choices: Array of available options

Validation options

Key Type Description
required boolean Requires the field to be completed to submit the form.
minimum integer For text fields, specifies the minimum number of characters allowed.
maximum integer For text fields, specifies the maximum number of characters allowed.
pattern regex; string For text fields, a regular expression specifying the allowed input.
type string For input fields, you can specify the type of input that should be expected (text, email, date, number, url, tel, color

Adding form templates to a category

After creating a template:

  1. Navigate to the category where you want to use the template.
  2. Click the :wrench: button to edit the category.

  1. Toggle the Advanced settings button (if using the new simplified category design).
  2. Go to the Template tab.
  3. Turn on the Form template toggle.
  4. Select the form template in the drop-down menu.
  5. Click Save category.

When multiple templates are assigned to a category, users will see a template picker when creating topics.

Member Experience

Creating topics with form templates

When a member creates a topic in a category with form templates, the form automatically appears in the composer. If multiple templates are applied to the same category, members can choose the right template from a drop-down. If users try to create a topic without accurately populating each field, theyโ€™ll see a validation error.

Pre-filling form values

Form fields can be pre-populated using URL parameters that match field IDs. For example: /new-topic?software-version=2.4.1&severity=Critical

This is useful for linking to topic creation with certain fields already filled.