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.
Number Validation
Our form fields have an automatic simple validation built into them if the field name contains the word "number". In this case 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 the visitors try to submit the form.
In order for this validation to be active, you do not need to use any additional code, having the word "number" in the field name is enough, noting that this only applies to the words in English.
Email Validation
When adding a new form, the form contains two form fields by default; Name and Email. The default Email field will have 'Email Validation' enabled already. Having this Email Validation enabled ensures that the input entered by the page visitor must be comprised of the name@domain.com format. If an email address format is not typed in, the field will display an error message when the visitors try to submit the form.
However, if you are customising your form and adding new form fields, the input entered by the page visitor will no longer automatically follow any validation format by default. You will have to manually ensure that the correct formatting options are selected from the dropdown inside the page builder, since formatting for newly added form fields are set to 'none' by default.
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.