Current section: Form Validation 5 exercises

Server-side Validation and Custom Error Messages


00:00 Even though the browser supports built-in validation and you can even customize that validation with JavaScript, this is really easy to circumvent. Users can literally just open up the DevTools and go down to here and say, you know what, I think it should have a max length

00:15 of thousands and then they can circumvent our validation that way. Or they could just hit the endpoint directly, just look at what the network is doing and do that same thing and do whatever they want to with it. So we absolutely always, no matter what, you should have validation on

00:32 the server. So that's what we're going to do in this exercise. I want you to add some validation for the title and the content on the server side. And I also want you to display error messages. So while we do have some error message right here, we want to be able to customize that to

00:48 match our aesthetic. And so I'm going to give you a component that you can render for those error messages. And I want you to render those error messages that the server sends back so that we can give the user not only some protection against themselves, but also some help as they

01:05 work through this stuff and then match our own design and totally customize that. So there are a couple of things that you're going to be doing in this step of the exercise and it's going to be awesome. Have a good time. We'll see you when you're done.