• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

editing document.form.value field name

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
in my jsp page, i allow the user to add items to a list and the list is displayed on the same page. The field name of the new item is incremented by 1.
for example
for item 1 - field name is 'level0'
for item 2 - field name is 'level1'
for item 3 - field name is 'level2'
etc.

I using this way to save the values later in an array.

But my question is that:
I need to check the value of the field in javascript.
I am sending the length of the array to my javascript function but how to i get the value of the field.

What i am doing in js:
for (var x = 0; x < length; x++)
{
var fieldValue =document.form2.level'+x+'.value;
}

But this does not work.

Does anyone has any suggestions how i can read the value of the fields?

Thanks in advance

Anil
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, of course that won't work.

You need to use the alternative fetch notation:



When posting code, please use UBB code tags as I have done.
 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks



Anil
 
reply
    Bookmark Topic Watch Topic
  • New Topic