The Wufoo Blog

Using Rules to Show Fields Dynamically on a Registration Form

By Andrew Gosnell · February 3rd, 2014

Hey, everyone! In this edition of Tips and Tricks, we’re going to look at how to display a varying number of fields in a registration form. We’ll do that by using Wufoo’s Rule Builder to create dynamic logic in the form.

Suppose we have a registration form where we want to allow multiple people to sign up, but the number could vary between entries. To start out, we’ll put five Name fields in our form, enough for the registrant and up to four additional guests:

But what if someone is registering just two people total? It’d be nice if the form could show the appropriate number of Name fields. So let’s add a new drop-down field and find out how many guests our registrant will be bringing along.

Now that we know the number of fields we should be displaying, let’s go to the Rule Builder and create field rules on our form. For each of the name fields, we want to consider the conditions where the field should be shown.

First off, the ‘Name 1’ field. We know that they’ll always be registering at least one person, so we don’t need a rule for that field—we want it to always show.

For the ‘Name 2’ field, it should be shown if the registrant chooses the option for registering 2 people. But we also want to show the ‘Name 2’ field if they choose 3, 4 or 5 people. For this, we’ll use multiple conditions to create the rule.

Similarly, we only want to display the Name 3 field if the registrant chooses 3, 4 or 5 people.

And we continue on thusly for the Name 4 and 5 fields.

And that’s all there is to it! When our registrant chooses the number of guests, they’ll see the appropriate number of Name fields thanks to our fancy new rules.

if you need to allow for more fields, no worries, this technique can be extended further. Just remember the general concept—start with the field you want to show, and figure out the lowest number where you should show that field. Make a condition based on that number, and continue making conditions for every number higher than that.

Have fun making your dynamic registration forms!

This entry was posted 2 months ago and was filed under Tips & Tricks.

Comments

  1. Quick pro tip that really helps when this technique is applied to items with a lot of options— you can use “if ‘How many people…’ is not 1” for your first rule, and save yourself all the other conditions.

    With that, and the fact that you can use “hide” in addition to “show,” in theory the number of conditions in your rules should never be more than half the number of options.

    Posted 2 months ago by Jed Wood.
  2. Q: What are the limits on using rules? Are there only so many rules you can use? Thanks!!!

    Posted 2 months ago by William.
  3. Q: How can I generate Avery #74459 hanging name badges after exporting this multiple-registrant form to Excel? The export displays all names in a horizontal format and I’ve not found how to generate name badges unless in a vertical format.

    Posted 2 months ago by Beth.
  4. Are these just so many rules one can use?

    Posted 2 months ago by Michael O'Reilly.
  5. You can have a max of 50 rules for each type. So 50 field rules, 50 page rules, and 50 form rules.

    Posted 1 month ago by Johan Lieu.
  6. Can someone respond to Beth’s question above? We have the same issue. We need to print name tags and we also have issues with the registrants names all coming out on the same row. We also need each person to be in different row. Can anyone help??!!

    Posted 1 month ago by Jen D.
  7. I think using a formula in excel that drops to the next row every time it finds a unique identifier would do it. How to do that…. IDK

    Posted 1 month ago by Jason.
  8. Please forgive this stupid question, but do I understand that I need to create a condition for each number and I have to put the for the each of the higher numbers in that condition?

    Posted 1 month ago by Kim.
  9. Jen D…once the data is in Excel, select all the data, right click then choose copy, then right click in an empty cell and choose paste special transpose. That should put the names in one column with one name on each row.

    Posted 1 month ago by Kim.

Add a Reply

You may use HTML for style.

Comments will be closed on May 4, 2014.

  • Search

  • About

    The Wufoo Blog is the official online publication written by the developers of Wufoo about their online form builder, form-related technologies, and whatever else may fit their fancy—like robots.

  • Archives