Hi,
I am having trouble figuring out how to concatenate the following (but not as a string):
A page is dynamically generated via ASP. There are multiple input fields similar to below:
<input type="text" name="Input1Field">
<input type="text" name="Input2Field">
<input type="text" name="Input3Field">
And so on....
I am using a global javascript function to check that data has been entered in each field. However, because these are dynamically generated form input fields, I cannot know in advance how many there will be (Input[n]Fields above are also dynamically labeled).
So, in my Javascript function, I need to have
for(x=0;x<max;x++)
{
var check = form.Input[x]Item.value
}
for each x... so I can capture values for each input field.
When I try to concatenate the above as
for(x=0;x<3;x++)
{
var check = "form.Input" + x +"Item.value"
//I have an alert function to check if value is captured
alert(check)
}
I get an alert that reads
"form.Input1Item.value" or
"form.Input2Item.value" or
"form.Input3Item.value"
which of course doesn't help me because I need the value of the input field and not the string...
I hope this makes sense... I can't use an array because I don't know how many items I will have per form section...
So, in short, I need to be able to concatenate
form.Input[x]Item.value for each x but retain this as non-string
Any input would be appreciated.
Thanks!
I am having trouble figuring out how to concatenate the following (but not as a string):
A page is dynamically generated via ASP. There are multiple input fields similar to below:
<input type="text" name="Input1Field">
<input type="text" name="Input2Field">
<input type="text" name="Input3Field">
And so on....
I am using a global javascript function to check that data has been entered in each field. However, because these are dynamically generated form input fields, I cannot know in advance how many there will be (Input[n]Fields above are also dynamically labeled).
So, in my Javascript function, I need to have
for(x=0;x<max;x++)
{
var check = form.Input[x]Item.value
}
for each x... so I can capture values for each input field.
When I try to concatenate the above as
for(x=0;x<3;x++)
{
var check = "form.Input" + x +"Item.value"
//I have an alert function to check if value is captured
alert(check)
}
I get an alert that reads
"form.Input1Item.value" or
"form.Input2Item.value" or
"form.Input3Item.value"
which of course doesn't help me because I need the value of the input field and not the string...
I hope this makes sense... I can't use an array because I don't know how many items I will have per form section...
So, in short, I need to be able to concatenate
form.Input[x]Item.value for each x but retain this as non-string
Any input would be appreciated.
Thanks!