struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance" <>
Subject RE: Struts form design question
Date Tue, 01 Aug 2006 12:21:25 GMT
I do this using 3 actions

loadAction - called first time the page is loaded, populates the form with
values from the db, the form has "session" scope.

editAction - called by a click on the add or delete button, adds or removes
a row from the form. Add and delete buttons should post to this action so
that any field changes will be picked up.

saveAction - commits the form to the db, called by a save button.

This means that clicking on add and save requires a page refresh but it
means struts will read input fields into your form automatically. Im sure
you could go the ajax way and add / delete from your ActionForm without
re-loading the page.

-----Original Message-----
From: Adam Gordon [] 
Sent: 31 July 2006 21:02
To: Struts Users Mailing List
Subject: Struts form design question

Hi folks.

The more I think of this problem, the more I think that we will be unable to
use only Struts for this particular situation.

We have a table which we populate with a user's choice of custom
registration fields (name, email, phone, company, etc...).  Each row in this
table is essentially a button to remove the row, a text field to enter the
name of the field, and a checkbox to indicate whether or not that particular
field is required when a user registers.  At the bottom of the table is an
"Add Field" button which will insert a new row in the table. 

Right now, the "Add Field" and "Remove Row" buttons are implemented in
JavaScript because we don't want to edit the database every time the user
makes a change.  Additionally, we want the ability to "reset" the table back
to what the user had originally (the user's defaults can change over time,
and since they come from the database, this is why we don't want "live"

Initially creating the table isn't the problem, we can use DynaForms to
correctly create the table, the problem is how/can we read the values (the
rows of textfield/checkbox items) back when the user is finished editing
using Struts?  I don't think we can use DynaForms because the user can
change what was originally rendered...or am I misunderstanding DynaForms?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message