my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes multiple form question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "multiple form question" Watch "multiple form question" New topic

multiple form question

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
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

Joined: Nov 08, 2001
Posts: 15385
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.
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
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:
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%>">
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.
I agree. Here's the link:
subject: multiple form question
It's not a secret anymore!