RE: Problem with email form validation
you need to add a "return false;" in there. like this function CheckEmail() { if(!ValidEmail(document.EmailForm.Email)) { alert("cfoutput#data.a73#/cfoutput"); return false; } return true; } otherwise, the script will always return true, and always think the email is correct. chris olive, cio cresco technologies [EMAIL PROTECTED] http://www.crescotech.com -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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]
RE: Problem with email form validation
Firstly, you should have your CheckEmail function return false if the validation fails - it looks like you haven't specified that within the function. Then, in your form tag, call the function by doing: onSubmit="return CheckEmail();" Bob -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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]
RE: Problem with email form validation
Added form.submit = false at the end when it fails validation -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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]
RE: Problem with email form validation
Use CFFORM ACTION="blah.cfm" METHOD="POST" ONSUBMIT="return CheckEmail();" -Original Message- From: Randy Adkins [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 9:33 AM To: CF-Talk Subject: RE: Problem with email form validation Added form.submit = false at the end when it fails validation -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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] 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]
Re: Problem with email form validation
I'm sorry, but it still submits the form. It must be because of the scripts created by ColdFusion. - Original Message - From: "Christopher Olive, CIO" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, October 24, 2000 12:02 PM Subject: RE: Problem with email form validation you need to add a "return false;" in there. like this function CheckEmail() { if(!ValidEmail(document.EmailForm.Email)) { alert("cfoutput#data.a73#/cfoutput"); return false; } return true; } otherwise, the script will always return true, and always think the email is correct. chris olive, cio cresco technologies [EMAIL PROTECTED] http://www.crescotech.com -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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] 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]
Re: Problem with email form validation
I did this and it still doesn't work. It must be related to the scripts created by ColdFusion for the CFForms. - Original Message - From: "Bob Silverberg" [EMAIL PROTECTED] To: "CF-Talk" [EMAIL PROTECTED] Sent: Tuesday, October 24, 2000 12:09 PM Subject: RE: Problem with email form validation Firstly, you should have your CheckEmail function return false if the validation fails - it looks like you haven't specified that within the function. Then, in your form tag, call the function by doing: onSubmit="return CheckEmail();" Bob -Original Message- From: Michael Gagnon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 24, 2000 10:51 AM To: CF-Talk Subject: Problem with email form validation 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] 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]
Re: Problem with email form validation
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 thinkIt'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]