Want to save time by having your form field choices automatically created and updated for you? WPForms makes it easy to include fields based on post-types or taxonomy. In this article, we’ll show you how to do that by creating dynamic field choices.
When to Use Dynamic Field Choices
Existing posts, pages, tags, and categories can provide valuable information for form submissions, allowing you to dynamically populate dropdowns, multiple choice, or checkbox fields.
You can easily ask users to select the appropriate option, without having to input it manually.
These are just a few of the reasons you might use dynamic field choices:
- Ecommerce – If you have products listed in WooCommerce or other ecommerce, you can ask users to specify the item in question.
- Real Estate – Users can submit a form with a question about a particular property or related to a specific agent.
- Services – It will be more efficient for you when customers clarify which services are requested.
- Frontend Post Submissions – Allow visitors to select from your blog post categories when submitting a post.
How to Use Dynamic Field Choices
Also, you’ll need to have a form created. See our tutorial on How to Create a Simple Contact Form as an example to get started.
Now we’re ready to add a dynamic field choice!
Go to your form fields. Add a dropdown, multiple, or checkbox choice field and then click on it in the preview panel at right.
In the Field Options panel at left, under Advanced Options, select the Dynamic Choice option. At this time, you can choose between a Post Type (Posts, Pages, or Custom Post Types) and Taxonomy (Categories or Tags).
In our example, we’re choosing the Custom Post Type of Products. When you view this form, all published products will be viewable. Users can select which item they are referring to in their form inquiry.
Now you’re all set! You’ve create a form with dynamic fields auto-populated with data from existing content within your website. Now, whenever your post type or taxonomies are updated, the form will be automatically updated along with them.
We hope this tutorial helped you create dynamic field choices in WordPress. You might also want to check out our guide on How to Create a Contact Form Popup in WordPress.