Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the registration.html page created in the prior assessment to send a query (that has all input field information from that form) to a second

Modify the "registration.html" page created in the prior assessment to send a query (that has all input field information from that form) to a second page (interests.html (created by you)). The information should be stored in hidden input fields (in the interests.html page) using the same field id/name. The interests page should ask the user to enter the following in optional fields:

Interests (list at least three using a checkbox). Newsletter sign up (radio box with a yes/no option). Comments (free form text area). Referred by (text field).

When the user presses submit, all of the input fields from this form as well as the registration.html form will be saved into a cookie. The user should then be forwarded to a third page (confirm.html (created by you)) that will read the cookie information and display it in a name/value pair using JavaScript. Make sure to do the following: Create and integrate a script on the registration.html page that stores the input field data into hidden fields to be used in the interests.html page once the submit button is pressed. Create an interests.html page with a form that has the fields listed above. This interests.html page will read in the input from the query string data from the registration.html page and store them into hidden input fields. Write a script that runs in response to the submit event, from the interests.html page, that saves the input from both pages to a series of cookies to store each input, and opens a third page called confirm.html that reads and displays information from all the fields.

MY CODE

registration.html

Invitation Page

CapellaVolunteers.org

  • Home
  • Invitation
  • Gallery
  • Registration

Username:

Password:

Verify your Password:

First Name:

Last Name:

Email:

Phone Number

Sign up for newsletter: Yes No

This events site is for IT-FP3215 tasks.

registration.js

function formValidation() {

//VARIABLES SET FOR EACH

var uid = document.registration.userName;

var passid = document.registration.password;

var conpassid = document.registration.passwordVerify;

var fname = document.registration.firstName;

var lname = document.registration.lastName;

var uemail = document.registration.email;

var phn = document.registration.phno.value;

if (userid_validation(uid)) {

if (passid_validation(passid)) {

if (checkpass(passid, conpassid)) {

if (allLetter(fname)) {

if (allLetter(lname)) {

if (ValidateEmail(uemail)) {

if (phonenumber(phn)) {

document.forms["registration"].submit();

setCookie("uid", uid.value, 1);

setCookie("passid", passid.value, 1);

setCookie("fname", fname.value, 1);

setCookie("lname", lname.value, 1);

setCookie("uemail", uemail.value, 1);

setCookie("phn", phn, 1);

}

}

}

}

}

}

}

return false;

}

function setCookie(cname, cvalue, exdays) {

var d = new Date();

d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));

var expires = "expires=" + d.toUTCString();

document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";

}

function userid_validation(uid)//CHECKING FOR USER ID VALIDATION

{

var uid_len = uid.value.length;

var letterNumber = /^[0-9a-zA-Z]+$/;//VAR FOR ENSURING CORRECT CHARACTERS

if (uid_len == 0)//ENSURING NOT EMPTY

{

alert("User Id cannot be empty");//ALERT IF USERiD IS EMPTY

uid.focus();

return false;

}

else if (uid.value.match(letterNumber)) {

return true;

}

else {

alert("User Id should be alphanumeric");

uid.focus();

return false;

}

}

function passid_validation(passid)//PASSWORD VALIDATION for 8 characters

{

var passid_len = passid.value.length;//CHECKING FOR PASSWORD LENGTH

if (passid_len == 0) {

alert("Password cannot be empty");

passid.focus();

return false;

}

else if (passid_len < 8)//AT LEAST 8 CHARACTERS

{

alert("Password length must be at least 8 characters.");

passid.focus();

return false;

}

else

return true;

}

function checkpass(passid, conpassid)//VERIFY PASSWORDS MATCH

{

if (passid.value == conpassid.value)//COMPARE PASSWORDS

{

return true;

}

else {

alert("Confirm passwords, they do not match");//ALERT IF THEY DO NOT MATCH

conpassid.focus();

return false;

}

}

function allLetter(fname)//validate first name for correct characters

{

var letters = /^[A-Za-z]+$/;

if (fname.value.match(letters)) {

return true;

}

else {

alert(" First Name or last name has to be letters and it can not be blank");

fname.focus();

return false;

}

}

function ValidateEmail(uemail)//validate email to be correct format

{

var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;//right format

if (uemail.value.match(mailformat)) {

return true;

}

else {

alert("You have entered an invalid email address!");//alert if email is invalid

uemail.focus();

return false;

}

}

function phonenumber(phn) {//validate phone number to be in xxx xxx xxxx format

var phoneno = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;//format for phone number

if (phn.match(phoneno)) {

return true;

}

else {

alert("Please enter the phone number with digits in this form: XXX XXX XXXX");

return false;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions