I want to verify if all fields of the form are filled up or not. Here is the function I use which I call in form using onsubmit (see below). It opens sell.asp without checking. Please help me find my error. Thank you.
<HTML>
<HEAD>
<script language=Javascript>
<!--
function Empty()
{
if ((document.frmItem.ItemName.value == null) || (document.frmItem.Description.value == null) || (document.frmItem.AskingPrice.value == null) || (document.frmItem.Place.value == null))
{
alert ("Please complete all fields");
return false;
}
else
{
if <%Session("success")%>
{
alert ("Please go to step 3 to add an image");
return false;
}
else
return true;
}
}
-->
</SCRIPT>
<FORM ACTION="sell.asp" NAME="frmItem" METHOD="POST" onSubmit="return Empty()" target="_blank">
<HTML>
<HEAD>
<script language=Javascript>
<!--
function Empty()
{
if ((document.frmItem.ItemName.value == null) || (document.frmItem.Description.value == null) || (document.frmItem.AskingPrice.value == null) || (document.frmItem.Place.value == null))
{
alert ("Please complete all fields");
return false;
}
else
{
if <%Session("success")%>
{
alert ("Please go to step 3 to add an image");
return false;
}
else
return true;
}
}
-->
</SCRIPT>
<FORM ACTION="sell.asp" NAME="frmItem" METHOD="POST" onSubmit="return Empty()" target="_blank">