Myspace Code - Skype - Debt Consolidation - Loan - Internet Advertising

PDA

View Full Version : Why oh Why


oo7ml
Oct 18th 2007, 5:16 am
Hi, i have a simple contact form (name, email, message) that has JS validation on it. However, it does not seem to work in FF but it works perfect in IE.

In FF, it only picks up if the name field is blank, and not the validation on the email or message field, however in IE it works perfect for all fields. Can someone please take a look as i have spent ages trying to figure it out and i am getting no where, thanks

site url: http://simoncasey.ie/joc/contact.html

Jamie18
Oct 18th 2007, 12:08 pm
my guess is that when the validate_name function returns true the form gets submitted.. comment out the validate_name function and see if the e-mail field becomes the only one to be validated..

phper
Oct 18th 2007, 5:37 pm
Firefox has a built-in JavaScript console that shows any script errors on the page you open (go to Tools => Error Console).

This is the error message I got:
"contact is not defined"
on this line:
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(contact.email.value))

ezpz
Oct 18th 2007, 9:50 pm
I think in FireFox you need to qualify the form name - try

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contact.email.value))

oo7ml
Oct 19th 2007, 6:53 am
thanks guys