bricks_create_form
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
When to Use
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
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
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
page_idnumberREQUIREDparent_idstringoptionalpositionstringoptionalappend Values: append, prependform_settings.submit_button_textstringoptionalSubmitform_settings.success_messagestringoptionalform_settings.actionsarrayoptionalemail, redirect, mailchimp, sendgrid, webhook, registration, login, lost-password, create-post, update-post, save-submission, customform_settings.spam_protectionobjectoptionalfieldsarrayREQUIREDstylesobjectoptionalCode 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.
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
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
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
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.