Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Email Validation

I had read some posts in the old forum regarding using the custom javascript verification area to check that an answer appears to be a valid email address and I've attempted to try some solutions but have not been successful.  Does anybody have any script they currently use that works for them?
asked Apr 16, 2012 by Jay Rutherford Platinum (50,145 points)

1 Answer

0 votes
Here you go, this only looks at making sure that it looks right, not that it necessary is a valid active email account (sorry for the delay, never saw this posted), in this case you post it in the custom javascript screen. In this case I am using question q7, you would need to update the ssi get value to whatever your open-ended question is.


function emailvalidate(parText, parPattern)
{
if(parPattern.test(parText) == false)
{
return "You have entered an invalid email address.";
}
else {return "";}
}

{
address = SSI_GetValue("q7");
pattern = /^([A-Za-z])+([A-Za-z0-9_\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
strErrorMessage = emailvalidate(address,pattern);
}
answered May 24, 2012 by j.bratton Bronze (620 points)
Perfect! Thank you, just what I needed.
...