Guys,
I am very new to the whole Javascript thing and am looking for some assistance. I don't even know if it is possible to do what I want to do. I have a "dynamic" form in that when it comes to validation I won't have a definite idea how many rows of input boxes I will have.
One input row has 6 input text boxes ( 3 must be numeric and one must be a date ). They are named line1, delivery1, qty1, partid1, description1 and date1. However, once the user fills in these fields, they can choose to enter another part order. Thus, a second row of input boxes is displayed. ( i.e. line2, delivery2, qty2,......). When it comes to final validation, I won't know what the names of all the fields to be validated - i.e. I can't hardcode them into a validation script.
However, I have a hidden form field which stores the number of rows in the form. When it comes to order submission, I need to validate the contents of all the input fields. Is there some way that I can do something like:
for (i=0; i<document.myform.numrows.value; i++) {
if (document.myform.Qty(i) =""
{ // I know this is not right but this is the kind of thing I want to do
alert ("Enter a quantity value in row i"
}
}
I am very new to the whole Javascript thing and am looking for some assistance. I don't even know if it is possible to do what I want to do. I have a "dynamic" form in that when it comes to validation I won't have a definite idea how many rows of input boxes I will have.
One input row has 6 input text boxes ( 3 must be numeric and one must be a date ). They are named line1, delivery1, qty1, partid1, description1 and date1. However, once the user fills in these fields, they can choose to enter another part order. Thus, a second row of input boxes is displayed. ( i.e. line2, delivery2, qty2,......). When it comes to final validation, I won't know what the names of all the fields to be validated - i.e. I can't hardcode them into a validation script.
However, I have a hidden form field which stores the number of rows in the form. When it comes to order submission, I need to validate the contents of all the input fields. Is there some way that I can do something like:
for (i=0; i<document.myform.numrows.value; i++) {
if (document.myform.Qty(i) =""
alert ("Enter a quantity value in row i"
}
}