Modifying Form Validation Error Messages

Follow

Modifying Form Validation Error Messages

When a visitor fills out the form on your page but their form entry doesn't validate, they'll see some errors, which look like this by default:

errors1.png

If you like, you can customize these errors in a couple of ways:

Customize the wording

You can modify the wording by adding a snippet of Javascript to your landing page. Here's the script:

To add it to your page, click Javascripts in the bottom left of the Page Builder, and then paste the script in. Then, adjust the bottom script to add your custom messages.

errors3.png

For example, if you have a field with the ID of email_address, you can adjust its error messages with a line like this:

errors.changeField('email_address', 'Please enter an email address', 'This email address is invalid');

Here's the result:

errors2.png

 

Was this article helpful?
8 out of 11 found this helpful