Easy way to deal with Dynamic Form elements

2003-06-13 Thread Giampiero De Ciantis
I have basically a shopping cart application and I am wondering what is the
easiest way of updating the quantity of each item in the shopping cart.
Populating the page with the list of cart items is easy. I have no clue how
I will process the Dynamic form elements that represent the quantity of each
item in the cart.

 

Thanks

 

-Gp



Re: Easy way to deal with Dynamic Form elements

2003-06-13 Thread Erik Price


Giampiero De Ciantis wrote:
I have basically a shopping cart application and I am wondering what is the
easiest way of updating the quantity of each item in the shopping cart.
Populating the page with the list of cart items is easy. I have no clue how
I will process the Dynamic form elements that represent the quantity of each
item in the cart.
Presumably whatever class represents a CartItem has, in addition to a 
property pointing to an selection from your wares, a property to 
represent the quantity?  Then you simply need to update this quantity in 
the Action when a user specifies a quantity?

Or am I just not understanding you.

Erik



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Easy way to deal with Dynamic Form elements

2003-06-13 Thread Giampiero De Ciantis
Sorry, I didn't explain myself.

Basically the page that shows the cart contents will have an unknown number
(Cardinality 0..*) of items listed. Beside each item there will be a text
box where the user can input the quantity of the item that they want to
order. When the user hits checkout or updateQuantity I have to be able to
figure out what item they are updating.

So, How do I know which item they are trying to update once I get to the
CartAction that does the processing of the form?

Thanks for the reply.

-Gp

-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED] 
Sent: June 13, 2003 2:58 PM
To: Struts Users Mailing List
Subject: Re: Easy way to deal with Dynamic Form elements



Giampiero De Ciantis wrote:
 I have basically a shopping cart application and I am wondering what is
the
 easiest way of updating the quantity of each item in the shopping cart.
 Populating the page with the list of cart items is easy. I have no clue
how
 I will process the Dynamic form elements that represent the quantity of
each
 item in the cart.

Presumably whatever class represents a CartItem has, in addition to a 
property pointing to an selection from your wares, a property to 
represent the quantity?  Then you simply need to update this quantity in 
the Action when a user specifies a quantity?

Or am I just not understanding you.


Erik



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Easy way to deal with Dynamic Form elements

2003-06-13 Thread Erik Price


Giampiero De Ciantis wrote:
Sorry, I didn't explain myself.

Basically the page that shows the cart contents will have an unknown number
(Cardinality 0..*) of items listed. Beside each item there will be a text
box where the user can input the quantity of the item that they want to
order. When the user hits checkout or updateQuantity I have to be able to
figure out what item they are updating.
So, How do I know which item they are trying to update once I get to the
CartAction that does the processing of the form?
The text box is a text input, right?  It has a name attribute.  Assign 
a meaningful name, such as item1Quantity or item32Quantity, so that 
in your CartAction, you can then extract the HTTP parameters (using 
getParameter(String)) and you can perform whatever logic you need to 
perform now that you know (1) the name of the item and (2) the quantity 
set by the user.

Erik

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]