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.
Leveraging basic browser validation
From the course: JavaScript: Web Form Programming
Leveraging basic browser validation
- One of the easiest ways to help reduce form data errors, is to constrain the information that the user can enter into any given field. So let's open up the basic validation start file. And let's go ahead and bring this up in the browser as well. And you can see that this is a similar version of the stock purchasing form that we used for the output element example. So, the first problem that we want to fix is that we want to make sure that the user enters a stock symbol. So that they can't leave this field blank. So let's go back over to the code. And what we're going to do is to ensure that a value is entered. We're going to use the required attribute. So I'm going to scroll down here to my stock symbol input field and I'll just simply add the required attribute. So now, the user can't submit the form without a value being in that field. And we can do the same thing for the email field. So let's go ahead and scroll…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Overview of form validation approaches2m 10s
-
(Locked)
Leveraging basic browser validation3m 21s
-
(Locked)
Implementing better browser validation6m 43s
-
(Locked)
Using CSS to enhance dynamic validation9m 47s
-
(Locked)
Filtering key input9m 57s
-
(Locked)
Using JavaScript for validation7m 3s
-
(Locked)
Challenge: Form validation2m 21s
-
(Locked)
Solution: Form validation3m 53s
-
(Locked)
-