...or are you calling the function in the form onsubmit handler or onclick of a submit button?
Code:
function validate(f){
if (f.prod_id.options[f.prod_id.selectedIndex].value != f.prod_id_chk.value )
{
alert("Please enter same Product ID.");
f.prod_id_chk.focus();
return false;
}
//other validations here
//...
return true; //no error, continue submission
}
...
<form name="add_prod" action="..." method="post" onsubmit="return validate(this)">
...
<input type="submit" value="Submit">
or:
Code:
<form name="add_prod" action="..." method="post">
...
<input type="submit" value="Submit" onclick="return validate(this.form)">
</form>
The 1st method is recommended, though...