You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Derek Clarkson <dc...@waterwerks.com.au> on 2003/12/05 01:38:22 UTC

Multiple Forms

Hi all, me again ;-)

Heres one. How do I handle an unknown number of forms. For example, lets say I 
am outputting 5 records from a database. Each row needs to have a small form 
to update a value fro that row. These updates are all the same, using the 
same form and action, but sourcing different data.

I've tried having the same form on each row, but it appeared to store the 
wrong value in the form bean when I hit submit. Usually the value from the 
last form on the page seemed to be the one stored rather than the one I had 
hit update on.

So I'm currently using the older html input controls without any forms. I'm 
adding javascript code to each control to update a single form at the bottom 
of the page which contains hidden elements. Each submit button then tells 
this form to submit. This works ok, but it's messy and I'm sure there must be 
a way to handle what is effectively an array of forms.

Any ideas ?


Regards,
Derek Clarkson
Analyst/Programmer
Waterwerks Pty Ltd
Melbourne
Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Multiple Forms

Posted by Andrew Hill <an...@gridnode.com>.
Use 1 ActionForm with a nested collection of beans for the rows

see: http://www.keyboardmonkey.com/next/index.jsp

-----Original Message-----
From: Derek Clarkson [mailto:dclarkson@waterwerks.com.au]
Sent: Friday, 5 December 2003 08:38
To: struts-user
Subject: Multiple Forms


Hi all, me again ;-)

Heres one. How do I handle an unknown number of forms. For example, lets say
I
am outputting 5 records from a database. Each row needs to have a small form
to update a value fro that row. These updates are all the same, using the
same form and action, but sourcing different data.

I've tried having the same form on each row, but it appeared to store the
wrong value in the form bean when I hit submit. Usually the value from the
last form on the page seemed to be the one stored rather than the one I had
hit update on.

So I'm currently using the older html input controls without any forms. I'm
adding javascript code to each control to update a single form at the bottom
of the page which contains hidden elements. Each submit button then tells
this form to submit. This works ok, but it's messy and I'm sure there must
be
a way to handle what is effectively an array of forms.

Any ideas ?


Regards,
Derek Clarkson
Analyst/Programmer
Waterwerks Pty Ltd
Melbourne
Australia

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org