Chapter 15. Using JavaScript with web forms

After completing this chapter, you will be able to

  • Understand how to validate the input to a web form using JavaScript.

  • Work with radio buttons, select boxes, and check boxes, both to get their values and to set their state.

  • Provide feedback based on validation, both through an alert() dialog box and inline within the document.

  • Understand the limitations of JavaScript form validation, and see an example of validation gone wrong.

JavaScript and web forms

JavaScript has been used with web forms for a long time—typically, to quickly verify that a user has filled in form fields correctly before sending that form to the server, a process called client-side validation. Prior to JavaScript, a browser had to send ...

Get JavaScript Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.