1. Home
  2. Knowledge Base
  3. WP Optin Wheel
  4. How to's
  5. How to add custom validation to your opt-in form

How to add custom validation to your opt-in form

Note: this tutorial is meant for the premium version.

You may want to add some custom validation on one of the fields displayed on the opt-in form. You can do so by adding some custom Javascript code to your theme. Not sure how to add Javascript to your theme? It’s really easy! Read this article for more information.

Example 1: only contain numbers

Below is the code to only allow numbers. This can be handy to validate a phone number in a text field.

Please supply your license key to unlock the code

Since this is a custom-coded snippet, we kindly ask for your license key so our system can verify your purchase.

Take note of the filter id ‘wof-validate-MMERGE3’. Replace MMERGE3 with the ID of your field. The ID can be found in your email list software such as MailChimp.

Example 2: enter a date before January 1, 2018

This advanced example will test that a date entered is before 1 January 2018:

Please supply your license key to unlock the code

Since this is a custom-coded snippet, we kindly ask for your license key so our system can verify your purchase.

Was this article helpful?

Related Articles