Date field with custom error message displayed when date must be between Monday and Friday.

Earlier this year, we released our custom validation rules feature. But what exactly are custom validation rules?

Simply put, you have the ability to create your own error messages underneath your form fields and set the conditions that cause those messages to display.

Creating Custom Errors

Say, for example, that your business doesn’t operate during the weekend. With the custom error option, you can set an error message to display underneath your Date field if your customers try to select a Saturday or a Sunday.

To begin, click on the field that you want to contain a custom error. Then, find the “Show Custom Error” option at the bottom of the field settings and select When.

Custom error allows users to create validation rules and custom error messages.

Next, the conditional logic builder will appear. Here, you can specify what conditions on the form will cause an error message to appear. In the example with our business only operating during the week, we want an error message to display when the day of the week is Saturday or Sunday:

Conditional logic builder shows error when the day of the week is Saturday or Sunday.

Make sure to save your changes. Now, in the second blank box, you can write your custom message:

Custom error message to display underneath form fields

Finally, if your customers tries to select Saturday or Sunday in the Date field, they’ll see your custom error message:

User can only select Monday through Friday error message.

Validating Fields

There are many different scenarios in which you can take advantage of this unique feature, such as confirming that two email fields match.

In addition to setting conditions with basic conditional logic, you can also use the Advanced Editor to write calculations. In this case, we want an error message to appear when our second email field is not the same, or equal to (=) the first email field:

Calculation to ensure the two email form fields match.

Next, write your custom message in the second box:

Custom error message field informs users that emails do not match.

Now, when a user types in an email that doesn’t match the original Email field, a message will appear to let them know.

Email address in the Email field does not match the email in the Confirm Email field.

Have any questions about custom errors or how to create them? Feel free to contact us and let us know!


Nadia A.

Nadia A.

Nadia, the Technical Writer for Cognito Forms, develops documentation, support content, and how-to videos. No matter your experience – with her help, you'll be able to take full advantage of the product. In her spare time, Nadia enjoys listening to French house, drinking coffee, and talking about herself in third person.