Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple form elements with same name

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My page consists of several different forms. 4 of these forms has an element in common (customerNumber). All forms are rendered in HTML, but not all are shown(all but one is hidden).

So when I submit the form that is shown does not retain the value within its customerNumber. When I tried to rename its name it worked, but I would like to reuse the name, instead of having multiple names for the same purpose value element.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "name" do you mean name or id?

There is no problem having multiple elements with the same name, even within the same form. id is a different matter.
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
By "name" do you mean name or id?

There is no problem having multiple elements with the same name, even within the same form. id is a different matter.


When I used the same name on similar form elements, then on submit those values did not make it to the Servlet. Only when I renamed them with unique name it worked.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you try to get the values in your servlet ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic