Forms

Forms are used throughout Latch. The admin dashboard itself is a series of forms, and content types are also modeled as forms.

Form names should be unique.

Here is a detailed look at each option in the form editor.

Tags

Each tag enables special behavior for the form. You can hover the tag name to view a description of what it does.

Common form tags include:

  • can_password_protect: Enables post password controls for forms whose database action is Create post.
  • captcha: Allows the Firewall extension to require CAPTCHA validation for the form.
  • slugs: Enables friendly permalinks for posts made with the form.
  • hide_submit: Hides the generated submit button.
  • hide_toolbox: Hides the post editor toolbox.
  • hide_breadcrumbs: Hides post editor breadcrumbs.

Database Action

Determines what happens when the form is submitted:

  • Create post: The submission is written to the latch_posts table. This is the standard choice for pages, articles, and custom content types.
  • Save to app: The submission is written to the latch_app table. This is primarily intended for core system settings.
  • Save to extension: The submission is written to the latch_extensions table. Latch matches the form name to an active extension's friendly package.json name, then saves the metadata under that extension's directory identifier.
  • Save to user profile: This option is available in the editor, but save_post() does not currently implement a user-data save branch. Treat it as reserved unless you provide custom handling.
  • Do nothing: The form submission is not written by the standard save branch. Use this when an extension or custom template handles the submission.

Submit Button Value

The HTML shown inside the form's submit button.

When omitted, Latch uses Publish for new public form submissions and Save Changes while editing existing objects or settings.

Destination

Optional redirect destination after a successful submission.

The destination can be an absolute path or a shortcode-backed value. Latch evaluates shortcodes before redirecting, so values such as [site]/thank-you are supported.

Inherit Forms

Adds fields from one or more other forms. Use comma-separated form names here, for example:

Shared SEO Fields, Shared Media Fields

After changing this value, save and reload the form editor to see inherited fields.

Controls the public path of posts made with a form carrying the slugs tag. The pattern supports %SLUG% and %FORM% macros and must contain %SLUG%.

For example:

documentation/%SLUG%

This produces paths such as /documentation/what-is-latch. Leave the field empty to use %SLUG%, which preserves the original root-level friendly URL behavior.

See macros.md for the macro syntax, available values, and additional examples.

Read Permissions

A tag list of role names and/or permission names that defines who can view saved submissions for this form.

Administrators bypass most permission checks.

Write Permissions

A tag list of role names and/or permission names that defines who can submit this form.

Public forms should keep this empty only when anonymous submissions are intended and any necessary validation is handled.

Fields

The content of your form: fields and groups.

Field order can be arranged using the left-hand vertical grip icon.

Actions such as creating a field, deleting a field, modifying a field, or duplicating a field are not written to the database until you click the "Save Changes" button. If you make a mistake, reload the page before saving.

Clicking the "Edit" button expands a field to reveal its options.

Name

Field names should be unique per form. For example, a form should not have two fields called "Title," but two different forms can each have a "Title" field.

Description

Shown on the frontend form as the fieldset label. You can include HTML content here, such as links or emphasis tags.

Attributes

HTML attributes packed into the fieldset element. You can assign classes, visibility status, or custom attributes here.

Latch's default theme Chanterelle supports these custom classes out of the box:

  • skinny: Removes the fieldset padding and visual container.
  • sticky: Allows the field to remain in view while scrolling.
  • space: Applies right-hand margin to the field.
  • flex-75: Applies flex-basis: 75% to the field. Variants such as flex-25, flex-33, and flex-50 are also supported.

Tags

Each tag enables special behavior for the field. For example:

  • collapsible: Renders the field as an accordion.
  • open: Opens a collapsible field or accordion by default.
  • required: Marks the field as required.
  • hide_name: Hides the field name.
  • hide_description: Hides the field description.
  • defer_js: Defers datatype JavaScript setup.
  • is_title: Marks this field as the post title source for title lookup and display.

Behaviors that are purely presentational should usually be implemented through attributes/classes. Tags are reserved for behavior that changes HTML structure, server behavior, or JavaScript behavior.

Data Type

The datatype controls how the field is rendered and saved. See datatypes.md for more information.

Groups

Groups are field containers. Groups can contain fields or other groups.

Clicking the "Edit" button expands a group to reveal its options.

Standard Options

Groups can be assigned a name, description, attributes, and tags, similar to a standard field.

Group Type

Latch provides these group layouts:

Accordion

An object whose fields can be expanded or collapsed.

Pair this with the open tag to have the accordion appear expanded by default.

Row

Renders the group's fields in a single row.

Use width classes such as flex-75, flex-50, flex-33, or flex-25 on child field attributes to control layout.

Column

Renders the group's fields in a single column.

This group type is mainly useful inside a row parent group.

Tab

Adds the group as a tab page.

For a tab menu to appear on the form, the form must have at least one tab group. When a form is submitted, data from all tabs is sent to the server, not only the visible tab.

Repeater

Allows the user to duplicate, sort, and delete copies of the group.

Use repeaters when you need an arbitrary number of repeated inputs.