Custom Validation on Field for Product Registration

Hello!

We’re working with a client who’s got a rather large database of customers who’ve purchased products (in the magnitude of thousands) and they’d like to provide a way for people to “register” their warranty on the website. We’d like to do that via Gravity Forms.

It’s my assumption that it would be too much to cross reference a serial number of a product against a huge database on each submission - so instead - what we’d like to do is add some sort of validation that will at least make sure the serial number is the same general pattern and people are not just entering in random data.

Is there a way to validate a field this way? To say make sure it follows the format of 5555-4355-3453-5345-3453?

Thank you!

Hi @znmick - you can use a single line text field with this input mask to force that format:

9999-9999-9999-9999-9999

That will enforce five groups of four digits, separated with dashes.

Thank you so much!

Is there any way we could force specific characters? Like the first letter must start with “B” or something like that?

Just trying to get the pattern as specific as possible.

You can use this input mask which will enforce the letter B first. In fact, they won’t be able to enter the letter B, it’s there already:

B9999-9999-9999-9999-9999

Here is more information about the input mask configuration:

Usage

  • Use a ‘9’ to indicate a numerical character.
  • Use a lower case ‘a’ to indicate an alphabetical character.
  • Use an asterisk ‘*’ to indicate any alphanumeric character.
  • Use a question mark ‘?’ to indicate optional characters. Note: All characters after the question mark will be optional.
  • All other characters are literal values and will be displayed automatically.

Examples

  • Date

Mask 99/99/9999
Valid Input 10/21/2011

  • Social Security Number

Mask 999-99-9999
Valid Input 987-65-4329

  • Course Code

Mask aaa 999
Valid Input BIO 101

  • License Key

Mask ***-***-***
Valid Input a9a-f0c-28Q

  • Zip Code w/ Optional Plus Four

Mask 99999?-9999
Valid Input 23462 or 23462-4062