Validation rules are an important tool for ensuring that data is accurate, complete, and consistent. Validation rules are used to check the data in a record before it is saved. Rules can be set to require specific data types, such as dates or numbers, meet the minimum or maximum values, or contain certain characters or text strings. Validation rules can also be used to enforce complex business rules, such as ensuring that a customer’s address matches the one on their credit card. With validation rules, you can ensure that your records always contain the correct information before they are saved.
Let’s see some useful tips to write good error messages.
- Give instructions that tell the user the type of entry that’s valid, such as birthday must be before today.
- Include the field label to identify the field that failed validation, especially if the error message appears in a common place such as a toast or a popup.
- Try to describe the source of the error.
- Avoid the “try again” at the end of every error message. Only use it if the error is related to a temporal error such as a network connection and a second try can resolve the problem. Trying again won’t make the problem to be resolved automagically, give some tips to the user to know how to resolve it, even if it is “Please contact the support team”
- Make sure the error message is not exposing sensitive data. Sometimes this is a good excuse to just display “internal error, try again”