LESSON 07 – ASSORTED TOPICS

 

WORK

 

QUESTION 1

In this question, we will look at the process of form validation.  This involves trying to avoid letting the user leaving a text field empty.  It also involves trying to ensure that the user enters the correct email address.

 

a) Recreate the following form without any text in the text fields.

b) Use an if statement to check if the First name text field is empty.  If it is, use the alert function to display a message.

 

c) Do the same as in b for all text fields.

d) Use an if statement to check that both emails are in fact the same.

 

e) Use an advanced if statement to check if all conditions are good.  If so, display a “Good Job!” message.  (Hint: You will likely want to use && to combine many conditions together.)