Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through html input fields ? 1

Status
Not open for further replies.

FredGexel

IS-IT--Management
Feb 14, 2001
19
CA
Hello folks,
I had a question concerning a form validator. Here's the context:

I got a Html form with 7 fields (hr1 , hr2 , ... , hr7) and I want to validate em in only 1 loop.

How would you do it ?

for(w=0 ; w<7 ; w++)
{
m = &quot;hr&quot; + w

...
somevar = document.form.m.value //(?!?)
...
}
 
When you want to use a variable in something like that, you need to eval it:
Code:
somevar = eval(&quot;document.form.&quot; + m + &quot;.value&quot;);
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top