Forms
Forms let you build user-facing forms — such as contact forms, signup forms, and surveys — directly in OptiPub. Each form belongs to a publication and can be embedded on any page using the optipub-form element. Submissions are stored in OptiPub and can optionally trigger email notifications.
Navigate to Content → Forms
Creating a Form
Click the Create button to open the form editor.
| Field | Required | Description |
|---|---|---|
| Publication | Yes | The publication this form belongs to. Cannot be changed after creation |
| Name | Yes | A name to identify the form in the admin (e.g. "Contact Us", "Newsletter Signup") |
| No | An email address to receive a notification each time the form is submitted | |
| Active | No | Whether the form is live. Inactive forms return a 404 on the public API |
Form Builder
Below the form fields is a drag-and-drop form builder for designing the form layout. Add fields by dragging them from the toolbar into the form canvas. Each field can be configured inline — click a field to set its label, placeholder, options, validation, and other properties.
Available Field Types
| Type | Description |
|---|---|
| Text | Single-line text input |
| Textarea | Multi-line text input with configurable rows and max length |
| Number | Numeric input with optional min/max constraints |
| Date | Date picker |
| Select | Dropdown menu with configurable options |
| Checkbox Group | Multiple checkboxes for selecting one or more options |
| Radio Group | Radio buttons for selecting exactly one option |
| Header | Heading text (h1–h4) for structuring the form |
| Paragraph | Static text block (paragraph, address, or blockquote) |
| Button | A submit or generic button |
Every form must have at least one element. If no submit button is included, one is automatically added when the form is rendered on your website.
Editing a Form
Click on any form in the list to view it, then click Edit to make changes. All fields except Publication can be updated. The form builder lets you add, remove, and reorder fields — you'll be prompted to confirm before deleting a field.
The form also supports auto-save, which periodically saves unsaved changes every 60 seconds.
List View
The form list displays all forms across publications in a searchable, filterable data table. The following columns are available:
| Column | Filter type | Default |
|---|---|---|
| ID | Number | Shown |
| Publication | Select | Shown |
| Name | Text search | Shown |
| Text search | Shown | |
| Active | Boolean | Shown |
| Created | Date | Hidden |
| Updated | Date | Hidden |
Each row includes a View Responses button to jump directly to that form's submissions.
Form Responses
To view submissions for a form, click the View Responses button on the form list, or navigate to Content → Forms → select a form → Responses.
Each response is displayed as a card showing the label and submitted value for every form element, along with the submission timestamp.
Displaying Forms on Your Website
Forms are embedded on pages using the optipub-form element with a form-id attribute:
<optipub-form form-id="1"></optipub-form>The element fetches the form definition from the public API and renders all configured fields. When a user submits the form:
- A bot protection challenge is verified (if enabled — see below)
- The response is saved to OptiPub
- If an Email address is configured on the form, a notification email is queued with the submission details
- The user sees a confirmation message: "Your response has been recorded. Thank you."
Bot Protection
When bot protection is enabled in your publication settings (Settings → Bot Protection), form submissions are verified using Cloudflare Turnstile or reCAPTCHA. The challenge is handled automatically by the optipub-form element — no additional configuration is needed on the form itself.
Duplicate Submissions
Each visitor is identified by a tracking identifier stored in the optipub cookie. If a visitor has already submitted a particular form, the form will display the success message instead of rendering the fields again, preventing duplicate submissions.
Email Notifications
When a form has an Email address set, each submission triggers a notification email to that address. The email contains the form name followed by each element's label and the submitted value.
Notification emails are queued and sent asynchronously to avoid slowing down the submission response.
Dynamic Form Pages
Forms can be used with dynamic pages. By setting a page path to {$sys_form.slug}, OptiPub generates an individual page for each form. Inside the page content, use system macros like {$sys_form.name} to render form data dynamically.
Updated 1 day ago
