Working with Forms and Window Objects Part 2

Practice Labs Module
Time
18 minutes
Difficulty
Intermediate

JavaScript Programming Code Welcome to the "Working with Forms and Window Objects - Part 2" Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Overview

Introduction

JavaScript Programming Code

Welcome to the Working with Forms and Window Objects - Part 2 Practice Lab. In this module, you will be provided with the instructions and devices needed to develop your hands-on skills.

Learning Outcomes

In this module, you will complete the following exercise:

  • Exercise 1 - Validating Forms

After completing this lab, you will be able to:

  • Set, get, and reset the values of form elements
  • Use the Window object methods and popup boxes in JavaScript
  • Validate form elements using HTML input attributes and onsubmit event

Exam Objectives

The following exam objectives are covered in this lab:

  • 1.5 Complete and debug code that interacts with the Browser Object Model (BOM)
  • 5.1 Complete and debug code that retrieves input from forms and sets form field values
  • 5.2 Complete and debug code that performs input validation
  • 5.3 Describe the form submission process

Lab Duration

It will take approximately 25 minutes to complete this lab.

Exercise 1 - Validating Forms

You can have validation checks enabled for the form elements. At run-time, the data entered in the form elements can be validated against certain conditions. This will ensure accuracy in the form inputs. This will also result in accurate data submission to the web server. You can use the built-in Window object methods such as prompt() and confirm() to accept inputs at run-time and confirm the form data submission process respectively.

In this exercise, you will learn how to validate form elements using HTML input attributes and onsubmit event. You will perform the following tasks:

  • Task 1 - You will download the Visual Studio Code workspace (Forms) from the Intranet and open the HTML page named Register.html in the Forms workspace.
  • Task 2 - You will learn to write JavaScript code to validate form elements using HTML input attributes and onsubmit event.
Learning Partner
Comprehensive Learning

See the full benefits of our immersive learning experience with interactive courses and guided career paths.