andytate
06-03-2005, 06:34 AM
I'm trying to validate a form which has twelve lines of information that the user can enter information on. Line1 has a fields qty1, desc1, stk1, glcol1, currency1, prc1 and slcUnit1. The other 11 lines are exact copies of Line1 with the numbers incresing accordingly. eg. qty2, desc2 etc. etc.
function validate_form ( )
{
valid = true;
if ( document.newReq.Qty1.value != "" && document.newReq.Desc1.value == "" || document.newReq.Stk1.value == "" || document.newReq.GLcolumn1.value =="" || document.newReq.currency1.selectedIndex == 0 || document.newReq.Prc1.value =="" || document.newReq.slcUnit1.selectedIndex == 0)
{
alert ( "Please check all entries for line 1 are completed." );
valid = false;
}
return valid;
}
I want to create a loop that will repeat the above for the 12 lines incrementing the number sequence automatically rather than write this statement 12 times and change the numbers myself.
I hope i've explained myself and I know this is probably easy to most of you guys but I'm new to Javascript, forgive me
function validate_form ( )
{
valid = true;
if ( document.newReq.Qty1.value != "" && document.newReq.Desc1.value == "" || document.newReq.Stk1.value == "" || document.newReq.GLcolumn1.value =="" || document.newReq.currency1.selectedIndex == 0 || document.newReq.Prc1.value =="" || document.newReq.slcUnit1.selectedIndex == 0)
{
alert ( "Please check all entries for line 1 are completed." );
valid = false;
}
return valid;
}
I want to create a loop that will repeat the above for the 12 lines incrementing the number sequence automatically rather than write this statement 12 times and change the numbers myself.
I hope i've explained myself and I know this is probably easy to most of you guys but I'm new to Javascript, forgive me