<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkFields() {
count = document.GRN.TotalItem.value;
for (var j = 1; j <= count ; j++)
{
Rec = eval("document.GRN.QtyRecevied" + j);
Order = eval("document.GRN.QtyOrdered" + j);
if (Rec.value > Order.value)
{
alert("There is an error in quantity. Please check."
return false;
}
}
return true;
}
function checkSubmit() {
if (checkFields())
{
document.GRN.submit();
}
}
// End -->
</SCRIPT>
<cfform action="GRN_action.cfm" method="POST" enablecab="No" name="GRN">
........Codes....
<input type="image" src="../../image/save_GRN.gif" onClick="javascript:checkSubmit()" alt="Save GRN">
</cfform>
When it return false, it still go to the action page. Why?
<!-- Begin
function checkFields() {
count = document.GRN.TotalItem.value;
for (var j = 1; j <= count ; j++)
{
Rec = eval("document.GRN.QtyRecevied" + j);
Order = eval("document.GRN.QtyOrdered" + j);
if (Rec.value > Order.value)
{
alert("There is an error in quantity. Please check."
return false;
}
}
return true;
}
function checkSubmit() {
if (checkFields())
{
document.GRN.submit();
}
}
// End -->
</SCRIPT>
<cfform action="GRN_action.cfm" method="POST" enablecab="No" name="GRN">
........Codes....
<input type="image" src="../../image/save_GRN.gif" onClick="javascript:checkSubmit()" alt="Save GRN">
</cfform>
When it return false, it still go to the action page. Why?