• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Drop Down Boxes With same name  RSS feed

 
Johnny Ganestruep
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I have multiple drop down boxes with the same name. In the case of a single drop down box one would use getparametervalues(). How would I retrieve multiple drop down box values in a servlet with the same name if 2 dimensional array are not possible?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Johnny WalkerTheInfamous",
Welcome to the ranch ! Please check your Private Messages for an important administrative matter.
 
Mohamed Sanaulla
Bartender
Posts: 3174
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Johnny Ganestruep wrote:Hello I have multiple drop down boxes with the same name. In the case of a single drop down box one would use getparametervalues(). How would I retrieve multiple drop down box values in a servlet with the same name if 2 dimensional array are not possible?


You need to provide unique names for each Drop down.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohamed sanaullah wrote:You need to provide unique names for each Drop down.

Not correct.

If there are multiple elements with the same name -- which is perfectly valid -- their values will be returned as an array by getParameterValues().
 
Mohamed Sanaulla
Bartender
Posts: 3174
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
mohamed sanaullah wrote:You need to provide unique names for each Drop down.

Not correct.

If there are multiple elements with the same name -- which is perfectly valid -- their values will be returned as an array by getParameterValues().


I meant different name for each drop down (and not for the options in the drop down). Say there are different <select> tags- each select will have a different name.

Or even in this case same name is sufficient?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohamed sanaullah wrote:I meant different name for each drop down (and not for the options in the drop down). Say there are different <select> tags- each select will have a different name.

Not correct.

Any number of elements within a form can have the same name. Do not confuse name with id, which must be unique.
 
Mohamed Sanaulla
Bartender
Posts: 3174
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
mohamed sanaullah wrote:I meant different name for each drop down (and not for the options in the drop down). Say there are different <select> tags- each select will have a different name.

Not correct.

Any number of elements within a form can have the same name. Do not confuse name with id, which must be unique.


Oh ok, thanks for the clarification.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!