How to Create Dynamic Field Choices

How to Auto-Populate Fields in WordPress Forms

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:

WPForms is the best WordPress Form Builder plugin. Get it for free!
  • 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

The first thing you need to do is install and activate the WPForms plugin. Here’s a step by step guide on how to install a WordPress plugin.

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.

How to Create Dynamic Form Choices

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.

Products Dynamic Dropdown
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.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Using WordPress and want to get WPForms for free?

Enter the URL to your WordPress website to install.

Comments

  1. Thanks for reading this article – I hope you found it helpful.

    I wanted to let you know about our new WordPress survey plugin that allows you to build interactive polls and surveys within minutes. You also get best-in-class reporting, so you can make data-driven decisions.

    You can get it 100% free when you purchase WPForms Pro plan.

    Get Started with WPForms Today and see why over 2 million websites choose WPForms as their preferred online form builder.

    Syed Balkhi
    CEO of WPForms

  2. Hi, I wondered if it’s possible to set the post submission category as a default (so each submission auto categorizes, and the post will only show in sections filtered to that category).

    I’ve tried using the dynamic options, but you can’t select a default answer. I’ve also tried using a hidden field with a default setting and linking this through the Meta section on the Post Submission settings form. This way keeps coming back as uncategorized.

    1. Hi Simon,

      We don’t currently have an option for this, but I do agree it would be super useful. I’ve noted this in a feature request so that our team can consider adding an admin-determined category option for post submissions in the future.

      In case it helps in the meantime, you might consider modifying your site’s default post category. This is set to ‘Uncategorized’ when WordPress is installed, but can be changed to any category (under Settings > Writing — here’s a screenshot). I apologize that this isn’t an ideal workaround, but I hope this helps!

      And thanks for the suggestion 🙂

  3. Hi,

    I’m looking to have the drop-down preselected to a choice based on a unique link. I want my users to press a “select” button under an image, then they are brought to the form at the bottom of the page with which ever choice they selected prefilled in the drop down.

    I already have the anchor figured out, now I just need to get the form to auto-populate their choice.

    Thanks

    1. Hi Nick,

      We don’t have a way to have the dropdown field preselected and auto-populate a choice based on a unique link but I’ve made a note on our feature request list so we can keep it on our radar! Thanks for the suggestion 🙂

  4. Hi, is it possible to pull usernames and/or email address in WP Forms from a SQL database? I’m looking for an easier way to import data than manually typing in over 300 employees.

    1. Hi Dan,

      We don’t have a way to do this right now, but I’ve made a note on our feature request list so we can keep it on our radar! Thanks for the suggestion 🙂

  5. I need a custom field to show from the selected dynamic post. Is this in the pipeline? Or is there a way I could hard code it? Thanks

    1. Hi Matt,

      I’m afraid I don’t quite understand what you’re trying to do so can you clarify a bit? Are you trying to get a field to conditionally appear based on the selection a user makes in a dynamic field?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.