In this section, we are going to add validation to our movie form. First, notice that the release date is automatically initialized to the default value for daytime objects in .net, and the number in stock is initialized to zero. If you follow the steps shown in this section, you will end up with a form like this.
For this exercise, don't worry about the initial values in the form. Just do the exercise and watch the next lecture for different ways to solve this problem.
In terms of actual validation, all fields are required, and for the number in stock, it should be between 1 and 20. I have used the range data annotation and enabled client-side validation. Additionally, the page is protected using an anti-forgery token.
Go ahead and complete the form, including client-side validation and anti-forgery tokens, and watch the next lecture when you finish.
video txt