I have a form with several textboxes. They are all named txtNumClaims1, txtNumClaims2, txtNumClaims3, .........txtNumClaims12 and they all hold numbers. I wrote a function called isItNumber() to check for the presence of a number.
I think I can use a "for" to loop through each of the txtboxes to check for validation, can't I? The code below is incorrect, but I think it will give you the idea of what I'm trying to accomplish. Can someone help me?
function formValidation() {
var currentForm
currentForm=document.frmChart
for (var boxCount = 1; j < 12; boxCount++) {
if (isItNumber(currentForm.txtNumClaims+boxCount) == false) {
alert("Please enter a number.);
currentForm.txtNumClaims+boxCount.focus();
return false;
}
}
i.e. i'm trying to concatenate the boxCount variable to the end of the name of the textbox I'm evaluating instead of writing that block of code twelve times.
Any help is much appreciated.
Seek not outside yourself; heaven is within.
I think I can use a "for" to loop through each of the txtboxes to check for validation, can't I? The code below is incorrect, but I think it will give you the idea of what I'm trying to accomplish. Can someone help me?
function formValidation() {
var currentForm
currentForm=document.frmChart
for (var boxCount = 1; j < 12; boxCount++) {
if (isItNumber(currentForm.txtNumClaims+boxCount) == false) {
alert("Please enter a number.);
currentForm.txtNumClaims+boxCount.focus();
return false;
}
}
i.e. i'm trying to concatenate the boxCount variable to the end of the name of the textbox I'm evaluating instead of writing that block of code twelve times.
Any help is much appreciated.
Seek not outside yourself; heaven is within.