I have an html page that has fields created with a loop in asp from a sql table and they are called Agency1, Agency2… and their are a variable number of them based on a hidden field called Total. When this form is submitted I need to put all of the data from these fields together in one field separated by a comma, so I created a loop as follows:
var agencynumber;
var numberOfAgents;
agent_code = Agency1.value;
numberOfAgents = Total.value;
numberOfAgents = numberOfAgents + 1
for (i = 2; i <= numberOfAgents; i++)
{agencynumber = “Agency” + i
agent_code = agent_code + “,” + agencynumber.value
}
what I want to happen is that agencynumber is a string called Agency1… Agency5 and that agencynumber.value gives me the value of the html form field agency, but that doesn’t seem to work. I’m pretty new to javascript so could use any help you could give me. Thanks, BostonRose