Click to See Complete Forum and Search --> : Question regarding Email Validation code
rpenman65
03-05-2009, 01:09 PM
I am attempting to use the code and it works however I am trying to figure out how to add the code to launch a specific page when the email conditions are met, if I enter in the incorrect email address I get the desired error, however if I enter in the correct email address it doesn't do anything and I want it to go to a specific page to view pictures. Can someone help me?
Thanks and God bless!:)
DustFrog
03-10-2009, 10:20 PM
Could you explain a little more on what you're wanting the page to do? For instance, are you asking how to go to a page if the email is correct on a form submit? Or how to open a new tab/window on a form submit or button click if the email address is correct?
Charles
03-11-2009, 07:29 AM
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example</title>
<script type="text/javascript">
String.prototype.isEmailAddress = function () {return /^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/.test(this)}
</script>
</head>
<body>
<form action="http://dirty.pix.com/" onsubmit="if (!this.email.value.isEmailAddress()) {alert ('Are you ashamed or something?'); return false}">
<fieldset>
<legend>Identify yourself</legend>
<label>E-mail Address<input name="email"></label>
<button type="submit">Submit</button>
</fieldset>
</form>
</body>
</html>
DustFrog
03-13-2009, 03:08 PM
Charles,
Just looking at the code, it appears right. I copied your code and tested it myself (replacing the action of course :) ), and it worked for me. I'm using Firefox (Mac).
Maybe try testing it in a different browser to see what those results give you.