Ever wished you could limit form submissions so that a single user could submit only once? Run a contest with one-off coupons or prize codes? Offer discounts that can be redeemed by a customer only once? We know many of you do, as these scenarios and others like them have been some of the most popular feature requests we’ve gotten for Ninja Forms. Now you can!
Version 3.1.8 of Ninja Forms introduces the Unique Field setting to your WordPress websites. This field makes it possible to limit user submissions quickly and easily with a single setting. Keep reading and we’ll show you how it’s done and how it works!
The Unique Field Setting
This is going to be a really short introduction; this is so very simple there just doesn’t look to be that much to it. All the hard work happens behind the scenes! If you’re updated to version 3.1.8:
- Open any form and click on the Advanced tab at the top of the builder
- Choose Restrictions from the options you see there
- See the Unique Field Setting at the top of the Restrictions settings window!
Told you it’d be a really short introduction! While it doesn’t look that complex, what’s happening underneath the Ninja Forms UI is actually super complicated. At this time, you’ll only be able to set one field as unique for exactly that reason. We’re going to build on this so that you can eventually have more than one, however. Let’s look at how to use this thing now!
Using the Unique Field to Limit Form Submissions by User or Field
Again, from the UI this is a super simple setting to use. I’ve selected one of the basic Contact Me templates in my form builder and navigated to the Unique Field setting. Let’s say I want to accept a submission only once based on a user’s email address. I simply select the Email field from the Unique Field dropdown and (optional) configure the error message as desired:
That’s all there is to it! Now when a user attempts to submit this form using an email address that has previously been entered, they’ll receive the error message you’ve entered and the form will not submit.
Note that there are many other options in the dropdown:
Any of these fields can be selected and tagged as unique, allowing you to do much more than limit form submissions based on email alone.
What are some of the other things you could do with this feature? One-time-use coupon codes spring immediately to mind, as does restricting a user to claiming a discount only once. How are you going to be using it? We (and our other readers) would love to hear fresh ideas. Let us know in the comments!