How to Use Placeholders and Conditional Logic in the Kadence Form Block
Content
Many users of the Gutenberg Blocks with AI by Kadence WP plugin leverage its powerful Form Block to create custom contact forms, lead captures, and more. A common point of confusion, however, is how to properly use field placeholders and conditional logic to control where form submissions are sent.
This guide will walk you through the process of using these advanced features based on common community questions and solutions.
Understanding Field Placeholders
Field placeholders are powerful tokens that allow you to insert user-submitted data into various parts of your form's configuration. They are used by enclosing the field's name in curly brackets, like this: {field-name}.
A common use case, as seen in the forums, is dynamically setting the "From Name" in your email notifications. For example, if you have separate fields for First Name and Surname, you can combine them in the "From Name" field like this:
{first_name} {surname}
When the form is submitted, this will be replaced with the actual values the user entered, such as "John Smith". It's important to use the exact field name assigned in the form builder, without any spaces.
Conditional Email Routing
Another powerful application of placeholders is directing emails to different addresses based on a user's selection. This is ideal for businesses with multiple departments or branches.
Here is a step-by-step method to set this up:
- Create a Select Field: Add a dropdown field to your form (e.g.,
branch_selection) with options for each branch (Company A, Company B, Company C). - Map Emails to Choices: For each option in the dropdown, set its value to the corresponding email address (e.g.,
[email protected],[email protected]). - Use the Placeholder in Email Settings: In the form's Email Settings tab, locate the "Send To Email" field. Insert the placeholder for your select field:
{branch_selection}.
When a user selects "Company B" from the dropdown, the form will automatically send the submission to the email address you set as the value for that option.
Troubleshooting Common Issues
- Placeholder Shows Raw Text: If you see
{field_name}in your email instead of the user's input, double-check that the field name in your placeholder matches the field's "Name" attribute in the form builder exactly. These are case-sensitive. - Conditional Logic Not Working: Ensure that the values for your select options are properly formatted email addresses. The Kadence Form Block uses the value, not the visible label, for the email routing.
By mastering the use of placeholders, you can significantly enhance the functionality and automation of your forms, creating a more dynamic experience for both you and your website visitors.
Related Support Threads Support
-
Form blockhttps://wordpress.org/support/topic/form-block/
-
Advanced Form. Send message to a different email based on the chosen field.https://wordpress.org/support/topic/advanced-form-send-message-to-a-different-email-based-on-the-chosen-field-2/
-
Phone field validation in Formshttps://wordpress.org/support/topic/phone-field-validation-in-forms/
-
multiple field inputs in form-blockhttps://wordpress.org/support/topic/multiple-field-inputs-in-form-block/
-
Form Block – How to specify select default valuehttps://wordpress.org/support/topic/form-block-how-to-specify-select-default-value/
-
Form Block – Is it possible to delete select options?https://wordpress.org/support/topic/form-block-is-it-possible-to-delete-select-options/
-
Form builder – How to delete option in field type selecthttps://wordpress.org/support/topic/form-builder-how-to-delete-option-in-field-type-select/
-
Creating a link in Field Name (Forms)https://wordpress.org/support/topic/creating-a-link-in-field-name-forms/
-
Form Attachmentshttps://wordpress.org/support/topic/form-attachments-2/
-
Form Charactershttps://wordpress.org/support/topic/form-characters/
-
Form: Date as Field Typehttps://wordpress.org/support/topic/form-date-as-field-type/
-
Form settingshttps://wordpress.org/support/topic/form-settings-4/
-
Form Block – Auto Fill Fields?https://wordpress.org/support/topic/form-block-auto-fill-fields/
-
Form Block – Is it Possible to Insert Headings Into Form?https://wordpress.org/support/topic/form-block-is-it-possible-to-insert-headings-into-form/