Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

how to dynamically generate unique form elements  RSS feed

Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm being asked to update a JSP that displays records in table format, where one column is to be a drop down list form element.

Here's the situation:
There are 6 Types.
There can be 0, 1 or more Conflicts per Type.

Goal: to display a list of records under each type.

For example: if there are 3 records for Type 1, and 2 records for Type 2, the display should be:

1Brother A
2Brother I

The form element here is the Status field. It is a selection list; one can select from values to change the status.

How can I assign unique form element names to that field.
I first tried 2 for loops:
1 loop for the 6 types
The 2nd inner loop for the number of records per type.
I called the form element name status1, status2, etc�
The problem was when it was time for the Type 2 (2nd iteration in outer loop), the form element name started again at status1, status2, etc�

Can anyone help?
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is simple. You can get the unique status names by making the changes as given in bold.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!