This is a question related to how people are handling a situation in the user interface for a web application. I have a page which is displayed when a user wants to create/edit a Parent object. It has a few attributes related to this Parent object, as well as a Save button so the Parent can be saved. Each Parent object has a collection of Child objects (displayed in a grid on the same page), and on this same screen the user can add/modify/remove Child objects, similar to the following:
Parent Information:
ParentName: [textbox]
ParentDate: [datepicker]
Children Information:
ChildName ChildDate Delete
[textbox] [datepicker] [button]
[textbox] [datepicker] [button]
[textbox] [datepicker] [button]
[Add Child button]
[Save button] [Cancel button]
Notice that I really want to only have buttons when I need to: one Save button (to rule them all!). I am trying to enable the following scenario when the user is creating or editing a Parent object:
- The user modifies Parent information (nothing saved to database yet)
- The user adds/modifies/removes Child objects (nothing saved to database yet)
- The user clicks Save (and all Parent and Child information is saved)
Through all kinds of fancy AJAX-ish stuff I can make this happen without page refreshes, but I am saving all the intermediate changes to the into the user's session on the web server each time in the meantime. For example: the user clicks "Add" button (to add a new Child object), so I go into the session, retrieve the Parent object I already had put there and add a new Child to the collection of Child objects, then bind this to the datalist. The next time the "Add" button is clicked, I have to save off the changes the user made to the first Child entry back into the object I retrieved from the session and repeat the process.
Is this crazy? Maybe I am trying to force "state" onto a "stateless" web application and shouldn't be doing that. I understand the concept of having per-lineitem editing in a grid, but that just seems silly for small screens where there's a couple of pieces of info for the Parent, a couple for each Child, and it's a lot of extra clicking for the user.
I think this question is technology independent, but just in case you need to know this is an ASP.NET web app.