Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Let’s update our view so users can see error messages when they submit incomplete or invalid data.
Follow Along
To follow along commiting your changes to this course, you'll need to fork the aspnet-fitness-frog repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork>
cd aspnet-fitness-frog
git checkout tags/v4.4 -b displaying-validation-messages
Validation Summary Section Styles
The first time that you add a validation summary section to an ASP.NET MVC project, you’ll notice that it always displays, even when the form is in a valid state and there no messages to display. Luckily, this is easy to fix. ASP.NET MVC will add a CSS class named validation-summary-valid
to the summary section’s outer most
.validation-summary-valid
{
display: none;
}
That’s all there is to it!
In case you’re wondering, the Fitness Frog web app styles that were provided to you already includes this style, so that’s why we didn’t need to add it ourselves.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up