Silly js form drop down validation

Hi

I am using a really simple javascript validation script to validate 1 drop down field on a form. The fields have simple values 0, 1, 2, and 3. With value “0” the form shouldn’t submit.

The popup displays the message fine. When I click “OK”, the box dissapears and the form is submitted anyway, without letting me select a different value from my drop down list.

Am I missing something really daft here?

Many thanks

MrM

<SCRIPT LANGUAGE="JavaScript">
<!--
function validateForm(objForm)
{
	var returnStatus = 1;
	if (objForm.size.selectedIndex == 0) {
		alert("Oops! Please select a size...");
		returnStatus = 0;
	};
	if (returnStatus = 1) {
		objForm.submit(); 
	}
}
// -->
</SCRIPT>

Got it working with an on focus… :slight_smile:

<SCRIPT LANGUAGE=“JavaScript”>
<!–
function validateSize(){
if(document.add_to_basket.size.selectedIndex==0)
{
alert(“Please select an Item.”);
document.add_to_basket.size.focus();
return false;
}
return true;
}
//–>
</SCRIPT>