• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

get id of selected rows

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i have this html table that i populate with jstl .
in a hidden field i place the id :

on submit i call a javascript function:


the js script is:



i need to get the IDS from the table of the selected rows. just getting the first id in the list.no matter what i choose. any ideas of where about i am doing wrong here?
thank you
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not understand how selected rows pay into this.

element ids are singular so if you have multiple hidden elements, they need to have unique ids. You can reference them with their names.

Eric
 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
even if i delete the second hidden field..(saveRowId) i still cannot get the right rows
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is the code supposed to know what the selected rows are?

If you need to read the value of multiple fields, than you need to have a loop or multiple statements.

Eric
 
bubu lina
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is from my page. i have a for each, of course:
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And as I stated before ids are SINGULAR. You can not have multiple elements with the same id.

ALSO

Your HTML markup is invalid. Your hidden element NEEDS to be in one of the cells.

Eric
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic