# How to - form element variable

**URL:** <https://forum.kirupa.com/t/how-to-form-element-variable/99608>\
**Category:** Uncategorized\
**Created:** [January 20, 2004, 3:08pm UTC](https://forum.kirupa.com/t/how-to-form-element-variable/99608 "2004-01-20T15:08:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gak\_gak\_gak](https://avatars.discourse-cdn.com/v4/letter/g/6f9a4e/32.png) [@gak\_gak\_gak](https://forum.kirupa.com/u/gak_gak_gak)\
**Post date:** [January 20, 2004, 3:08pm UTC](https://forum.kirupa.com/t/how-to-form-element-variable/99608/1 "2004-01-20T15:08:06Z")

</div>

Hello,  
Im using a combo of asp and javascript in a web site. Depending on how many records are open when I poll the database is how many form elements I use to present the data to the user. The user then has the ability to close record. From here is when I get stuck… here is what I have.  
Varcount is the amount of form elements I have and is passed in to the validation.  
////////////////////////////////////////////////////

var i  
while (varcount\>0) {

if (form.action[varcount].options[form.action[varcount].selectedIndex].value==1)

varcount–;

}  
//////////////////////////////////////////////////

I have tried +varcount+, “varcount”

Thanks, Im gakked out on this JS
