Forum Moderators: open

Message Too Old, No Replies

form not working in firefox

submits anyway

         

susieone

1:31 pm on Jul 10, 2005 (gmt 0)

10+ Year Member



Hi I have a form that works well in IE, fields are checked for valid entries before submitting but in firefox it submits without checking.
sample code:

function submitForm(myForm) { //check all form fields are filled in, prompt user if not or invalid.

if(document.myForm.shipFirstName.value=="") {
alert("Please enter Your first Name.")
document.myForm.shipFirstName.focus()
return false
}

// and so on till return true at end.
then my on submit button is:

onsubmit="return submitForm(this)" now in firefox javascript console the error is.. submitForm not defined.

Help please.

kaled

12:07 am on Jul 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Best guess... there's some invalid markup somewhere. Try

[validator.w3.org...]

Kaled.

Rambo Tribble

1:06 am on Jul 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Only the form itself supports onsubmit. Place your handler in the form's opening tag, not in the button's tag.

dcrombie

10:11 am on Jul 11, 2005 (gmt 0)



You have two options:

<FORM ... onsubmit="return doStuff();">

or:

<INPUT type="submit" ... onclick="return doStuff();">

The former is better IMO as it also captures form-submits triggered by hitting Enter.

;)

susieone

3:26 pm on Jul 11, 2005 (gmt 0)

10+ Year Member



Hi all
form working fine now it was a fault with my regular expression. thanks everyone.