Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple form question

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a shopping cart web application. In the admin section I have ten items per page and each item has 10 columns of info that can be updated. Someone suggested to me that the most common technique is to make each item a separate form. But how would I do that since I have an additional restriction that I need to be able to update multiple items at the same time. I was wondering if someone could shed some light. How can I determine the best way to indicate which forms need to be updated?
Thanks for your time
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It all depends on what you have information wise and how you link that information to the form name.
With what you gave me, I have no clue how to guide you.
Eric
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure how common that is
Just an idea for you:
If you have a uniq id for each item, than you can do:
<form>
loop to print item info
{
<input name="id" type="hidden" value="<%=itemId%>">
<input name="prop1" type=text value="<%=itemProp1%>">
<input name="prop2" type=text value="<%=itemProp1%>">
}
</form>
than on server you can use
String[] ids = request.getParameterValues("id");
String[] props1 = request.getParameterValues("prop1");
String[] props1 = request.getParameterValues("prop2");
than loop through ids, and for item with id[i] set prop1 to props1[i] and prop2 to props2[i].
Client side gets a little bit more complicated if you need to use checkboxes, but not much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic