In this chapter, we will take a look at the Description, Mandatory, and Validation setting of a document type property.
The Description allows you to add a little bit more information for your content editor. For instance, if you added a new property called "Contact Email", of the type Textstring, what you can do in the description is add a little bit more information that will make it easier for your content editors to know what they need to input. Simply type some additional text and add the property.
Move it to the Settings tab and go to your content. **You can see the description is being displayed. **This is displayed right underneath the label of your property.
What can you do with the Mandatory setting? **It only allows content editors to publish a document if a value is provided. **Publish your page without a value for the "Contact Email".
Move back to your document type, and edit your *Contact Emai*l property, check Mandatory, and save. If you now try to publish, you are not able to. You will get a bit of detail saying that the Contact Email field in the Site Settings tab is mandatory. Your content editor will have to input a value for the Contact Email property, otherwise the page won't be able to publish.
In the validation setting, you can set up a regular expression.
Once set up, the expression has to match before our content editor is able to publish the page. This is handy. For instance, if you want to make sure that they input a valid email address, or a telephone number that has to match a certain format - then you can set up a regular expression. We won't go into detail about regular expressions, you just need to know that there are tools and sites available on the internet that you can just use. For instance, browse to regexlib.com and search for an Email regular expression.
Copy the expression, move back to Umbraco, and update your Contact Email property and set a regular expression in the validation setting. Remember to click on save.
Go back to Content and and enter and email that is not a valid email address, and try to publish, *You will not be able to. *
Again, you will receive an error message, saying that the Contact Email property at Site Settings is not in a correct format. If you do place it in a correct format, you will be able to publish your page.
Let's review this chapter.
This is the most important thing you need to learn about Umbraco. Understanding the concept of Document Types and how to work with them is the foundation of your Umbraco knowledge.