Question: Hands - On Project 6 - 1 In this project you will program the actions of a sign - up form in which users must
HandsOn Project
In this project you will program the actions of a signup form in which users must supply a user name, email address, and password for a new account. Passwords must be at least eight characters long and contain at least one letter and one number. As a validation test, the password must be entered twice to confirm that the user did not inadvertently mistype the password. If the password does not match the required pattern or if the two passwords are not identical, the password field should be flagged as invalid. A preview of the form in which the passwords are mismatched is shown in Figure
A completed webpage which displays a signup form. The webpage has a heading panel that has a blue background with the following heading that is centeraligned. Handson Project The content section has the following heading. Create your Account. Below this is the heading for the input fields which has the following text. Enter your Account Information. The following input fields are present. Username. john smith is entered. Email. j dot smith at example dot com. Password. A password is entered. Confirm Password. A save button is present below the input fields. An error bubble is displayed for the Password field with the following text. Your passwords must match.
Do the following:
Use your code editor to open the projecttxthtml and projecttxtjs files from the js project folder. Enter your name and the date in the comment section of each file and save them as projecthtml and projectjs respectively.
Go to the projecthtml file in your code editor and link the page to the projectjs file, deferring the script from loading until after the page loads. Take some time to study the signup form. Note that the pwd field contains a regular expression pattern that will be used to verify that the password is in the proper format. Save your changes to the file.
Go to the projectjs file in your code editor. Below the comment section declare the following variables: submitButton referencing the element with the id submitButton pwd referencing the element with the id pwd and pwd referencing the element with the id pwd
Create an event listener for the click event occurring with the submitButton that runs an anonymous function.
Within the anonymous function add the following if else structure:
If the pwd field fails the pattern match, display the validation message Your password must be at least characters with at least one letter and one number
Else if the value of the pwd field does not equal the value of the pwd display the validation message Your passwords must match
Otherwise, set the validation message to an empty text string.
Save your changes to the file and then open projecthtml in your web browser.
Verify that you cannot submit the form if your password is less than eight characters long and does not include at least one number and one letter.
Verify that you cannot submit the form if the two passwords do not match.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
