Hi,
I am using a form that has 3 rows with input fields for data and using an "insert sql" statement I am able to submit either 1 or 2 or all 3 depending on whether a certain field is populated on each of the rows.
This is the code
However I also need to validate that certain fields are also populated, i have managed to create the following code which works OK
My problem is that I also need to validate the fields in rows 2 & 3 if needed and I cannot get this to work at all. I created another function
And used the following
However the first function will validate but the second one gets ignored completely
Is there a Guru out there that can help ??
Any help would be greatly appreciated
Regards
Paul
I am using a form that has 3 rows with input fields for data and using an "insert sql" statement I am able to submit either 1 or 2 or all 3 depending on whether a certain field is populated on each of the rows.
This is the code
Code:
' Executing the sql insertion code
If strTID <> "" Then con.Execute sql_insert Else Counter= Counter+1
If strTID2 <> "" Then con.Execute sql_insert2 Else Counter= Counter+1
If strTID3 <> "" Then con.Execute sql_insert3 Else Counter= Counter+1
However I also need to validate that certain fields are also populated, i have managed to create the following code which works OK
Code:
<script language="JavaScript">
<!--
function validateform ()
{
valid = true;
if ( document.form1.txtTID.value != "" && document.form1.txtOrderS.value == "" || document.form1.txtBG.value == "" || document.form1.txtSize.value == "" )
{
alert ( "Please Enter Values For OrderQty, Board Grade And Sizes For Record 1" );
valid = false;
}
return valid;
}
//-->
</script>
Code:
<script language="JavaScript">
<!--
function validateform2 ()
{
valid = true;
if ( document.form1.txtTID2.value != "" && document.form1.txtOrderS2.value == "" || document.form1.txtBG2.value == "" || document.form1.txtSize2.value == "" )
{
alert ( "Please Enter Values For OrderQty, Board Grade And Sizes For Record 2" );
valid = false;
}
return valid;
}
//-->
</script>
Code:
<form action="InsertEnquiry.asp" method="post" name="form1" target="_self" onSubmit="return validateform(); return validateform2()">
Is there a Guru out there that can help ??
Any help would be greatly appreciated
Regards
Paul