Here's something... it's a bit of a 4.0 browser thing tho, so it's up to
you if you want to go with that....
<script language="Javascript">
function checkEmail(){
var ValidEmail =
/^[a-z0-9]([a-z0-9_\-\.]*)@[a-z0-9]([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
if (formname.email.value == 0) {alert('Email is Required');return false}
else if (ValidEmail.test(formname.email.value) == false) {alert('Invalid
Email Format.');return false}
else {return true}
}
</script>
<form action="index.cfm" name="formname" onSubmit="return checkEmail()">
</form>
This uses regular expressions... which is only in Javascript 1.2, and
only works on Netscape 4.0+ or IE 4.0+ I think.... It's up to you!!
Stuart Duncan
MaracasMedia Inc.
At 11:51 AM 10/24/00 -0300, you wrote:
>Hi!
>
>I was wondering if there was a way arond this problem.
>
>I am using the CFINPUT 's "Required" and "Message"
>options. They work great, except that I want to
>go further with the email verification.
>I inserted a script to verify the format of the
>email address. The problem is that if all the
>fields are correct except for the email format, this scripts
>correctly tells me that the email is not in a proper format,
>but after I click on OK, the form is sent anyways.
>
>Here is one of the scripts I tried:
>
><script language="JavaScript">
> function ValidEmail(item) {
> var lsAT;
> var lsDOT;
>
> lsAT = item.value.indexOf("@");
> lsDOT = item.value.indexOf(".");
>
> if (lsAT == -1 || lsDOT == -1 || item.value.indexOf(" ") != -1 || lsAT +
>1 >= lsDOT ) {
> return false;
> }
> return true;
> }
>
> function CheckEmail() {
> if(!ValidEmail(document.EmailForm.Email)) {
> alert("<cfoutput>#data.a73#</cfoutput>");
> }
> return true;
> }
>
> </script>
>
>
>Any help would greatly be apreciated.
>TIA!
>_____________________
>Michael
>
>------------------------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
>a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]