Automatic validation for email addresses and numbers in form fields

Please note that the snippets in this article will only work for pages using the new and improved page generator, the Thor Rendering Engine. We recommend testing the snippet functionality in case your page was created before 2019 or duplicated from an older page, as the two render engines have a different code structure in the backend. To migrate your older pages to the new Thor Rendering Engine, you can contact our support team at help@instapage.com.

Our form fields have automatic validation built into them:

  • If the field name contains the word "email", the input entered by the page visitor must follow the word@domain.tld format. Otherwise, the field will display an error message when they try submitting the form.
  • If the field name contains the word "number", the input entered by the page visitor must be comprised only of numbers and punctuation/symbols. If letters are typed in, the field will display an error message when they try submitting the form.

In order for this validation to be active, you do not need to use any additional code, having the words "email" or "number" in the field name is enough, noting that this only applies to the words in English.

Can I remove this functionality?

Yes. There might be situations where your use case for the form requires it, so you can use the code snippet below in order to disable the automatic validation. For example, you might have a field named Identification number which includes letters, that the visitor must enter.

Add the code snippet below in the Settings > Javascript > Footer section. You will need to change the field names in the first line of the code to match your own fields. Make sure that each field name is between single quotes and written exactly as it is in the form, with the proper capitalization and without extra spaces.

NOTE: If you are using multiple forms on the same page and they have different fields, enter all the targeted field names from all of the forms in the same line. Do not paste the code multiple times.