bricks_create_form

Phase 4AdvancedComplexity: 8/10
Create a form with 15+ field types and 8+ actions

Overview

Create a fully configured Bricks form on a page with fields, submission actions, styling, and spam protection. Supports 18 field types including text, email, textarea, select, checkbox, radio, file upload, datepicker, and rich text.

Forms can trigger 13 different actions on submission: email notifications, redirects, Mailchimp/SendGrid integrations, webhooks, user registration/login, post creation, and custom WordPress hooks. Multiple actions can run on a single submission.

Key Features

18 Field Types
Standard HTML inputs (text, email, number, date, file, password) plus Bricks-specific types (datepicker, richtext, image, gallery, rememberme, html).
13 Submission Actions
Email, redirect, Mailchimp, SendGrid, webhook, registration, login, lost-password, create-post, update-post, save-submission, custom hook, and more.
Spam Protection
Built-in support for reCAPTCHA (v2/v3), hCaptcha, and Cloudflare Turnstile. Plus honeypot and CSRF token protection.
Layout Control
Choose stacked, inline, or grid layouts with configurable column counts, gap spacing, and per-field width percentages.

When to Use

Creating contact forms with email notification and confirmation
Building newsletter signup forms with Mailchimp or SendGrid integration
Setting up user registration or login forms
Creating lead generation forms with webhook integration to CRMs
Building multi-step forms with file upload and datepicker fields
Prerequisites
An existing page to add the form to
For email actions: WordPress mail must be configured (SMTP plugin recommended)
For Mailchimp/SendGrid: API keys configured in Bricks settings
For spam protection: reCAPTCHA/hCaptcha/Turnstile keys configured in Bricks settings
For file uploads: WordPress upload permissions and sufficient disk space

When NOT to Use

Updating fields on an existing form — use bricks_update_form_fields instead
You need a form builder plugin like Gravity Forms or WPForms — this creates native Bricks forms
Simple search functionality — use the native search element instead

Parameters

9 Total Parameters2 Required7 Optional
page_idnumberREQUIRED
Page (post) ID to add the form to.
parent_idstringoptional
Parent element ID to nest the form inside. Omit for top-level section.
positionstringoptional
Where to insert the form relative to the parent.
Default: append Values: append, prepend
form_settings.submit_button_textstringoptional
Text displayed on the submit button.
Default: Submit
form_settings.success_messagestringoptional
Message shown after successful form submission.
form_settings.actionsarrayoptional
Array of action objects to execute on submission. Each has a type and type-specific settings (email_to, redirect_url, webhook_url, etc.).
Values: email, redirect, mailchimp, sendgrid, webhook, registration, login, lost-password, create-post, update-post, save-submission, custom
form_settings.spam_protectionobjectoptional
Spam protection configuration with type (recaptcha, hcaptcha, turnstile) and optional site_key/secret_key.
fieldsarrayREQUIRED
Array of field objects. Each requires type, label, and name. Optional: placeholder, required, width, options (for select/radio/checkbox), default_value, min, max, rows, accept, pattern.
stylesobjectoptional
Visual styling: layout (stacked/inline/grid), columns, gap, label_typography, input_typography, button_classes.

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Contact form with email notification

Create a standard contact form with name, email, subject, and message fields. Sends an email notification to the site admin and shows a success message.

JSON
bricks_create_form({
  page_id: 55,
  form_settings: {
    submit_button_text: "Send Message",
    success_message: "Thank you! We'll get back to you within 24 hours.",
    error_message: "Something went wrong. Please try again.",
    actions: [{
      type: "email",
      email_to: "info@example.com",
      email_subject: "New Contact Form: {subject}",
      email_content: "Name: {name}nEmail: {email}nnMessage:n{message}",
      email_reply_to: "{email}"
    }],
    honeypot: true
  },
  fields: [
    { type: "text", label: "Full Name", name: "name", placeholder: "John Doe", required: true, width: "50%" },
    { type: "email", label: "Email Address", name: "email", placeholder: "john@example.com", required: true, width: "50%" },
    { type: "text", label: "Subject", name: "subject", placeholder: "How can we help?", required: true },
    { type: "textarea", label: "Message", name: "message", placeholder: "Tell us about your project...", required: true, rows: 6 }
  ],
  styles: {
    layout: "stacked",
    gap: "20px",
    button_classes: ["btn-primary"]
  }
});

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Creating a contact form without an email action means submissions go nowhere. Always add at least one action (typically email) in the form_settings.actions array.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Set required: true on essential fields like name and email. Without it, users can submit empty forms.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 1935

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Email content supports {field_name} tags to include form data. Use them in email_subject and email_content to include the actual submitted values.

Tips & Warnings

Tips & Warnings

Use {field_name} tags in email_subject, email_content, and redirect_url to include submitted form data. The field name must match the name property of the field.

For spam protection, enable the honeypot field (invisible to users) as a baseline, and add reCAPTCHA or hCaptcha for stronger protection on public-facing forms.

Use the grid layout with field widths (e.g., width: « 50% ») to place fields side by side — name and email on one row, message full-width below.

Return Values

FieldTypeDescription
successbooleanWhether the form was successfully created.
form_idstringThe Bricks element ID of the created form.
fields_countnumberNumber of fields in the form.
actionsarrayList of configured submission actions.

Related Tools

Technical Details

Tool ID
bricks_create_form
API Endpoint
/bricks-mcp/v1/pages/{page_id}/forms
HTTP Method
POST
Namespace
content-queries
Source File
content/forms.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with 18 field types and 13 action types
20250101