ChrisRChamberlain
Programmer
Hi all
The following Form to E-mail script submits standard user entered information, but has no email address validatation :-
<html>
<head>
<title>Your title</title>
</head>
<body>
<form method="post" action="
<!--The title and URL of the form will be listed at the top of the e-mail-->
<input type="hidden" name="Form title" value="Source of form">
<!--Specify the e-mail address to which data from the form should be sent-->
<input type="hidden" name="SendMailTo" value="youremailname@btinternet.com">
<!--Specify the acknowledgement page to be seen by customers who have sent in the form-->
<input type="hidden" name="redirect" value="
<h1>Form title here</h1>
<p>explanatory text here</p>
<pre>
<b>Name</b>
<input name="Name">
<b>E-mail address</b>
<input name="E-mail address">
<b>Other info</b>
<input name="Other info">
<b>Description</b>
<textarea name="Description of pages" rows=5 cols=50></textarea>
<b>Radio buttons</b>
<input type="radio" name="year" value="1997"> 1997
<input type="radio" name="year" value="1996"> 1996
<input type="radio" name="year" value="1995"> 1995
<input type="radio" name="year" value="1994"> 1994
<b>Check boxes</b>
<input type="checkbox" name="category" value="choice A"> Choice A <input type="checkbox" name="category" value="choice B"> Choice B <input type="checkbox" name="category" value="choice C"> Choice C <input type="checkbox" name="category" value="choice D"> Choice D </pre>
<hr>
<center>
<input type="submit" value="Submit"> <input type="Reset" value="Start Again">
</center>
</form>
</body>
</html>
The following script validates an email address :-
<form name="validation" onSubmit="return checkbae()">
Please input a valid email address:<br>
<input type="text" size=18 name="emailcheck">
<input type="submit" value="Submit">
</form>
<script language="JavaScript1.2">
//Advanced Email Check credit-
//By JavaScript Kit (//Over 200+ free scripts here!
var testresults
function checkemail(){
var str=document.validation.emailcheck.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
testresults=false
}
return (testresults)
}
</script>
<script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="Kit</a></font></p>
The question is, how can you integrate the code from the email validation routine into the original script?
Alternatively, what other code would work?
TIA
![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)
The following Form to E-mail script submits standard user entered information, but has no email address validatation :-
<html>
<head>
<title>Your title</title>
</head>
<body>
<form method="post" action="
<!--The title and URL of the form will be listed at the top of the e-mail-->
<input type="hidden" name="Form title" value="Source of form">
<!--Specify the e-mail address to which data from the form should be sent-->
<input type="hidden" name="SendMailTo" value="youremailname@btinternet.com">
<!--Specify the acknowledgement page to be seen by customers who have sent in the form-->
<input type="hidden" name="redirect" value="
<h1>Form title here</h1>
<p>explanatory text here</p>
<pre>
<b>Name</b>
<input name="Name">
<b>E-mail address</b>
<input name="E-mail address">
<b>Other info</b>
<input name="Other info">
<b>Description</b>
<textarea name="Description of pages" rows=5 cols=50></textarea>
<b>Radio buttons</b>
<input type="radio" name="year" value="1997"> 1997
<input type="radio" name="year" value="1996"> 1996
<input type="radio" name="year" value="1995"> 1995
<input type="radio" name="year" value="1994"> 1994
<b>Check boxes</b>
<input type="checkbox" name="category" value="choice A"> Choice A <input type="checkbox" name="category" value="choice B"> Choice B <input type="checkbox" name="category" value="choice C"> Choice C <input type="checkbox" name="category" value="choice D"> Choice D </pre>
<hr>
<center>
<input type="submit" value="Submit"> <input type="Reset" value="Start Again">
</center>
</form>
</body>
</html>
The following script validates an email address :-
<form name="validation" onSubmit="return checkbae()">
Please input a valid email address:<br>
<input type="text" size=18 name="emailcheck">
<input type="submit" value="Submit">
</form>
<script language="JavaScript1.2">
//Advanced Email Check credit-
//By JavaScript Kit (//Over 200+ free scripts here!
var testresults
function checkemail(){
var str=document.validation.emailcheck.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!"
testresults=false
}
return (testresults)
}
</script>
<script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="Kit</a></font></p>
The question is, how can you integrate the code from the email validation routine into the original script?
Alternatively, what other code would work?
TIA
FAQ184-2483 - the answer to getting answered.
Chris ![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)