Modify simple javascript with validation


Discussion:

Q: Modify Simple JavaScript with validation

lab5xx.htm






Name


Course


Lab




Step 1: Using a text or HTML editor modify your lab5xx.htm page (see above) and save it as lab6xx.htm.

Step 2: Add a link to an external JavaScript file called lab6xx.js

Step 3: Create the external JavaScript file. Ensure that all of your form fields have a unique name on the lab6xx.htm file.

Step 4: Verify on the submission of the form the following:

- Ensure that none of the fields are empty.

- Ensure that Name field does not contain numbers and special characters.

- Ensure that the email field contains a proper email address using a regular expression condition in an ?if?then? statement. Use the code below (HINT: copy and paste code into Notepad to strip it of all formatting values BEFORE pasting into your HTML editor):

if (/^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/.test(YourForm.YourEmailField.value)){
return (true);
}else{
return(false);
}

Step 5: If the fields are empty return false to the browser and alert the user as to which fields are empty. If the email is incorrect, alert the user that they must correct the format of that particular field. However, if everything is correct you can return true to the browser and the form data will be sent to your professors email.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Modify simple javascript with validation
Reference No:- TGS01932704

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)