Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
January 18, 2005, 11:43 pm
rate this thread
i've been dealing with scenarios like this for a long time:
user wants to edit a set of existing data. suppose it's a list of employees.
the user wants to add a new user to the database, while doing a mass update
to all users, so, in this case, we have 5 employees on screen, the user
click's a "Add New User" button, and we add a new set of input fields for
the new user, in addition to the existing 5 sets of input fields. the
complications in a scenario are this:
1. if the user edits some of the fields for the existing users, then adds a
new user, we have to submit the form to get the new fields on screen. now,
we need to go to the database, get a record count of the first five fields
PLUS add a new set of fields for the new employee not yet in the database.
so our page logic now wants to say something like create a total of 6 sets
of input fields, 5 will have data pulled from the existing users in the
database, one set will be totally blank. this isn't too bad, but
2. what if the user edits some of the fields for the existing users, then
clicks the "Add New User" button. we've loaded the data from the database
for the existing 5 users, not the user's edited fields data.
as i say, i've dealt with this kind of thing before, but it's always a big
pain in the ass. i was thinking of just saving everything to the database
when we need to post the page to get the new fields we need and preserve the
user's edits. this means a lot more database transactions, though, so i've
not sure about the costs in terms of server work and page response. anybody
see a problem with this or have a better way of dealing with it?
Re: how to handle editing existing data while adding new data
> have a better way of dealing with it?
That's from the CMS for my personal site. For those who are curious, the
other headings on the page are:
Page Attributes -- lets you set META tags for the page itself. Some of the
meta tags are interpreted in special ways by the CMS -- for example
"DC.title" is used as the page <title> and <h1> heading.
Page Relationships -- used to build <link> navigation, site map and
Site Relationships -- used to build <link> navigation.
Page Body -- obvious.
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
- » looking for host where we can run a custom spam filter
- — Next thread in » Webmaster Forum