...

View Full Version : debug check email function



esthera
07-05-2007, 09:30 AM
i'm using

function checkemail(email){
var str=email
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
}


and then checking -
if (checkemail(form.C_EmailAddress.value)==false){
errorMsg += "Email Address is not valid\r\n";
error=1;

}

is there something wrong that i'm missing above???
i'm getting an error in a function below.
please advise.

Philip M
07-05-2007, 02:40 PM
if (checkemail(form.C_EmailAddress.value)==false){

C_EmailAddress.value is the value of the email address as input e.g. me@mydomain.com

change to

if (testresults == false) {

esthera
07-05-2007, 03:24 PM
no that doesn't have the value --


if i do

var testresults
function checkemail2(email){
var str=email
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
}


alert(checkemail2(form.C_EmailAddress.value));

then I still get an error

Philip M
07-05-2007, 05:51 PM
Is 'form' the actual name of your form?

It would help if you indicated what the message error is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum