P
Paul Fitzpatrick
Hi,
This is a real beginner question!
I have a form with a few types of products. I need to limit the number
that the user puts in for quantity of each product - I have to keep it
below 2.
So onsubmit of the form it checks that the values are less than 2. SO
far I have -
function checkscript()
{
max = 2;
if (document.forms[0].elements[0].value > max)
{
alert('Too many ordered');
return false;
}
else if (document.forms[0].elements[1].value > max)
{
alert('Too many ordered');
return false;
}
return true;
}
//-->
</script>
I just want to keep it basic - there is something I am doing rong, I
just can't spot it!
Thanks in advance!
This is a real beginner question!
I have a form with a few types of products. I need to limit the number
that the user puts in for quantity of each product - I have to keep it
below 2.
So onsubmit of the form it checks that the values are less than 2. SO
far I have -
function checkscript()
{
max = 2;
if (document.forms[0].elements[0].value > max)
{
alert('Too many ordered');
return false;
}
else if (document.forms[0].elements[1].value > max)
{
alert('Too many ordered');
return false;
}
return true;
}
//-->
</script>
I just want to keep it basic - there is something I am doing rong, I
just can't spot it!
Thanks in advance!