Forum Moderators: open
if (custForm.Phone.value.length==0)
{alert('Day time phone number is required.')
document.custForm.Phone.focus()
return false}
[b]str=document.custForm.EMail.value
filter=/^.+@.+\..{2,3}$/[/b]if (!filter.test(str))
{alert('Please input a valid email address!')
document.custForm.EMail.focus()
return false}
You might improve the pattern a bit by using this:
filter=/^.+@.+\.[a-z]{2,4}$/i
2 modifications:
* replaced a . with [a-z]. The dot stands for any character, including digits and punctuation chars. TLDs off course should only consist of letters, and that is what the [a-z] thing does.
* added the i-switch to the end of the pattern, to make it case-insensitive.
I believe in most cases the string before the country code is not longer than three letters, but in rare instances it can be longer: .police.uk is one example.