Custom Validation Error Messages Using Umbraco Properties

Built using Umbraco 7

Sometimes we need to display error messages to the user from Umbraco, but what happens if we cannot use the dictionary. Well in this post, I will show you how to do just that by using Umbraco properties.

First, we need to create a new doctype in Umbraco then a new tab. Within the tab, add the properties we want to display.

In the website project, create a new View Model for the form validation an example is shown below.

After everything is set up we can run the project and enter some dummy test data and submit the form.

As you can see, we now have working validation which pulls the messages from Umbraco.

Now if we disable JavaScript we can still return the error message from Umbraco, BUT WAIT, if you look at the error message, you can see it's displaying our placeholder that we entered in the text field in Umbraco.

This only happens when we have our placeholders, to get around this problem we need to add the following code.


Thank you for reading this blog, I hope you found it helpful.

Leave a comment