...

View Full Version : Form doesn't stop, just submits right after validateddfield. @Firefox only



marhoons
07-22-2010, 06:29 PM
hi dears,

I'm trying to do simple form validation.
But the form submits right after validated! at FireFox only. as i tried it at IE it works fine.

condition:
if return false the event must be stop, killed submitting the form value's.

my form is:


<form action="index.php" id="cat_form" method="post" name="cat_form" onsubmit="return cats();">


my js is:



function cats()
{
if (document.cat_form.txttitle.value=="")
{
alert ("Sorry, Don't keep it blank!!")
cat_form.txttitle.focus();
return false;
}
else if (document.farticle.txtperpg.value==0)
{
alert("Sorry, Value must be grater than Zero");
cat_form.txtperpg.focus();
return false;
}
else
{
return true;
}
}


Any Idea ?

abduraooft
07-22-2010, 06:41 PM
if (document.cat_form.txttitle.value=="")
{
alert ("Sorry, Don't keep it blank!!")
cat_form.txttitle.focus();
return false;
}
Don't you need that document reference, when you refer an element for the second time?

marhoons
07-22-2010, 06:53 PM
Thanks abduraooft for the great fast response.

its worked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum