I'm doing client side validation on a list box before I submit the page. It seems like the page is trying to upload the files as soon as the button is clicked rather than when the form is submitted. I run this script on the client side OnSubmit event of the form.
function
CheckProducts()
{
var products = document.getElementById("lbProducts");
var isSelected = false;
for (var i = 0; i < products.options.length; i++)
{
if (products.options[i].selected)
{
isSelected =
true;
break;
}
}
if (isSelected)
{
<%=Page.GetPostBackEventReference(btnNewAnalysis as Control)%>;
}
else
{
alert(
"You must select at least one comparison product");
return false;
}
}
Even I return false it seems as if the page is trying to upload the files. Is there a better way to do client side validation when using the upload control?
Thanks for your help