Hello. I am trying to create a for loop which will append 'i' to the form field selCategory. In the form I create one drop down list for each type of Category in a DB and name each of the fields selCategory1, selCategory2, selCategory3, etc. Now I want to use JavaScript to make sure that the user has selected at least one of the category fields. I am having trouble incrementing the category fields in the JavaScript code though. Here is what I have....
//Loop from one to the number of categories in the DB
for(i=1; i<=NumbCat; i++)
{
Temp = document.AddEvent.selCategory+i+.value
if (Temp == "")
{
//User has not selected this category
x = "false"
}
else
{
//User has selected this category
x = "true"
}
}
I guess that I can not append 'i' to the selCategory field. If anyone has any insite on this please let me know.
I hope this makes sence to everyone. Let me know if you need more info.
Thanks for the help,
Chris
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
//Loop from one to the number of categories in the DB
for(i=1; i<=NumbCat; i++)
{
Temp = document.AddEvent.selCategory+i+.value
if (Temp == "")
{
//User has not selected this category
x = "false"
}
else
{
//User has selected this category
x = "true"
}
}
I guess that I can not append 'i' to the selCategory field. If anyone has any insite on this please let me know.
I hope this makes sence to everyone. Let me know if you need more info.
Thanks for the help,
Chris
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->