Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

validating form data: Create a new document called l5p3.html. It should have a f

ID: 647190 • Letter: V

Question

validating form data: Create a new document called l5p3.html. It should have a form with a text input box for an email address and a Submit button. Submitting the form (either by clicking the button or pressing enter when the button has focus) should call a function that validates the email address. The function should use a regular expression to validate the email address and return true if valid, or use alert() to display an error message and return false if not. If the function returns false, the form should not be submitted. Otherwise, submit the form to http://webdev.spsu.edu/formtest.php. Your regular expression should test for exactly this:

Explanation / Answer

<!Doutype html>

<html>

<body>

<script type='text/javascrpit'>

function emailvalidate(value,massage)

{ var emailvalue = /^((^<>()[]\.,;:s@"]+(.<>()[]\.,;:s@"]+)*)(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}] | (([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;

}

if(element.value.match(emailvalue))

{

return true;

}

else

{

alter(massage);

value.focus();

return flase;

}

}

</scrpit>

<scrpit>

function otherwise()

</body>

<from action="http:webdev.spsu.edu/formtest.php" name="email" method="" action="">

Enter Email:<input type="text name="email" value="emailtype/">

<button type="button" the>submit</button>