From the course: JavaScript: Web Form Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing better browser validation

Implementing better browser validation

From the course: JavaScript: Web Form Programming

Start my 1-month free trial

Implementing better browser validation

- [Instructor] In the previous example we saw how to use some basic attributes that the browser provides to help place constraints on our input fields to help the user avoid entering bad data. But those constraints were pretty broad. We're basically limited to things like number ranges and character counts and whether a particular field is required. In this example we'll take a look at the pattern attribute which gives us a way of applying more detailed constraints on the form fields. So let's open up the improved validation start file, and let's also go ahead and bring this up in the browser. And this is basically the same example file as the basic validation one with the addition of a United States postal code field. In this basic validation example we limited the user to typing in between one and five characters for the given stock symbol, right, but that's not good enough since I'm still able to enter nonsense…

Contents