While adding a phone field to your online form can potentially impact lead generation, there are situations where it’s essential for collecting customer data on your WordPress website. This holds especially true for marketing efforts, given the significant impact of SMS marketing.
The great news is at Ninja Forms, all form fields — including the Phone field — are part of our free core plugin. Unlike WPForms, where you have to pay to access it!
Let’s take a look at how to add a phone field in WordPress and how you can leverage it along with a custom input mask feature, which is also free. Let’s dive right in!
Table of contents
- How to add a Phone field in WordPress
- Prevent duplicate phone numbers on your form
- Format a phone number field with a custom input mask
1. How to add a Phone field in WordPress
Whether you need a Phone field for your event registration form or send promotional offers to your customers by SMS, adding a Phone field to your WordPress form is easy and free with Ninja Forms contact form builder.
All you need to do is click on, or drag-and-drop the Phone field located under the User Information fields into your form builder.
Once you add a phone number field to your form, you’ll see multiple settings this field offers. To access them all, ensure you have the developer mode enabled to unlock all the features. (Don’t worry, it’s free!)
Now that you’ve learned how to add a Phone field to your form, let’s look at how you can prevent users from entering duplicate phone numbers.
2. Prevent duplicate phone numbers on your form
Imagine you’re running a promotional sign-up offer, and a user attempts to take advantage of it by repeatedly submitting the form using different email addresses but keeping the same phone number.
You can easily prevent duplicate phone numbers and entries using the Unique Field settings. This free Ninja Forms feature ensures a designated field has unique data entered into it.
You can access the Unique Field from the Restrictions tab. If you don’t see a feature, you enable the Developer Mode. Turning it on will give you access to new possibilities, even with the free Ninja Forms plugin.
Unique Field supports the following form fields:
The Phone field is not available in the Unique Field settings, so make sure you use the Single Line Text field as your Phone field.
Once you add the Single Line Text field to your WordPress form, rename the field label to Phone Number and navigate to the Restrictions tab.
Select the Phone Number (Single Line Text field) from the Unique Field dropdown and click Done to save this setting.
This setup will avoid duplicate submissions from the same phone number. You can also customize the error message that displays to user if he tries to re-submit the form with the same phone number. The error message will show up under the Phone Number field.
To create a phone field with an international country code dropdown, check our article Dropdown Select Field in WordPress Forms (Quick Guide).
3. Format a Phone Number field with a custom input mask
If you need to validate your Phone Number field in Ninja Forms, you should apply an input mask to this field.This feature instructs your field on what data is allowed to be entered into your form field and in which format.
There is a prebuilt Phone field in US format for phone numbers. For the US, it will format the number to look like this (_ _ _ ) _ _ _ – _ _ _ _.
If you need another format, you can apply a custom input mask. With the Custom option selected, you would be able to set a “Custom Mask” as shown below:
Please note that if you only want to enable numeric characters for your Phone field, you need to ensure that you insert the number ‘9’ into the Custom Mask field.
This number represents a numeric character and allows only numbers to be entered. For example, you would enter 9-999-999-9999, to format the phone number to (_) – _ _ _-_ _ _-_ _ _ _.
Want to learn more about the Input Mask from Ninja Forms? Check out the article How to Use Input Mask in Your Contact Form (Examples) to explore various use cases for this free feature.
You’ve just mastered the Phone field in Ninja Forms!
Congrats on learning about another free Ninja Forms field you can use on your WordPress forms. But you should not stop there! We encourage you to explore 10 WordPress Form Fields You Should Master to fully experience the difference of a truly free core plugin!
Remember, with Ninja Forms, you’re getting much more than just a contact form plugin. You’re accessing a powerful toolkit that empowers your form-building. Our core plugin is completely free, providing you with a wealth of form fields and features at no cost.
Unlike some other options, we believe in offering essential tools without any barriers. With Ninja Forms, you have the freedom to create forms that perfectly suit your needs, without having to spend a lot of money. Try Ninja Forms; download our free core plugin today!