473,473 Members | 1,469 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question that I have debated back and forth on

I have a form that displays a list of items. The user can either click on a
button called "New" to create a new item or double click on a row in the
list to edit that item. An edit form is displayed for the add or edit and
the changes are made and then the user clicks on a save or cancel button to
close the form. Here is the question.
Who should create the object for the form to add to or edit?

Should the form with the list create an object and then pass the object to
the edit form or should the edit form create the object?

Who saves the object the edit form or the list fom when it is returned to?

Bill
Oct 7 '07 #1
2 1171
Bill Gower wrote:
I have a form that displays a list of items. The user can either click on a
button called "New" to create a new item or double click on a row in the
list to edit that item. An edit form is displayed for the add or edit and
the changes are made and then the user clicks on a save or cancel button to
close the form. Here is the question.
Who should create the object for the form to add to or edit?

Should the form with the list create an object and then pass the object to
the edit form or should the edit form create the object?
To some extent, I think the choice is arbitrary. Either should work
fine, and so it depends on which design just feels better to you.

That said, if you want the edit form to be identical for new and
existing objects, then you may not want to have to include logic for
dealing with object instantiation in the edit form. This would be an
argument in favor of having the object created before showing the edit
form, created by the list form.

Since you specifically write that "an edit form is displayed for the add
or edit", this seems to imply that the same form is used for both. In
that case, I would think that having the list form create the object and
then using the edit form to allow the user to customize the values for
the object would work better.
Who saves the object the edit form or the list fom when it is returned to?
Define "saves". Are you storing these objects to a database? Writing
them to a file? Or are you simply asking how the data from the edit
form should make its way back to the object itself?

IMHO, this is again a somewhat arbitrary decision. Even if you put
instantiation of the object in the list form, you can either have the
edit form operate on a specific instance of the object, or simply
present values that eventually are read by the list form to assign back
to the object being edited.

Note that all of the above assumes you're doing everything through
explicit code. I haven't done this myself, but I think that with data
binding you can have the edit form behavior in a more automatic way with
the object. If you take advantage of that, then the decision is made
for you, as the object needs to already exist for the edit form to have
its controls bound to the object's properties, and the controls of the
edit form itself will directly assign values to those properties.

Since your questions imply that the question is open, I'm assuming
you're not doing anything like that. :)

Pete
Oct 7 '07 #2
Peter Duniho wrote:
[...]
That said, if you want the edit form to be identical for new and
existing objects, then you may not want to have to include logic for
dealing with object instantiation in the edit form. This would be an
argument in favor of having the object created before showing the edit
form, created by the list form.

Since you specifically write that "an edit form is displayed for the add
or edit", this seems to imply that the same form is used for both. In
that case, I would think that having the list form create the object and
then using the edit form to allow the user to customize the values for
the object would work better.
And just to clarify: the above assumes that your edit form takes (in the
constructor or some initialization method) a reference to the object
being edited. Of course, if you simply initialize individual values in
the edit form and then read them after the form has been dismissed for
assignment back into the object, you could even defer creation of the
object until after you know for sure that the user has accepted rather
than canceled the edit form.

Pete
Oct 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: C White | last post by:
I've got another drop list problem I am using the following code where users select a name, but it should pass a name and email into the table <select name="user"> <option value="<%...
2
by: Lisa Pearlson | last post by:
Hi, My php application (on Apache/Linux) needs to do the following: The PHP script receives a request from a client (binary), asking for certain records of data. My PHP script loops through...
45
by: Rakesh | last post by:
Hi, I have this function to reverse the given string. I am just curious if that is correct and there could be better way of doing it / probable bugs in the same. The function prototype is...
5
by: Charles F McDevitt | last post by:
I'm converting some old programs that use old iostreams. In one program, the program is using cout to output to the stdout stream. Part way through, the program wants to put some binary data out,...
6
by: Joel Byrd | last post by:
I want a website that works in the following way: It has a main content div, and of course menu items. When you click a menu item, it should use AJAX to change the main content div to the content...
16
by: DataPro | last post by:
New to Sql Server, running SQL Server 2000. Our transaction log file backups occasionally fail as the size of the transaction log gets really huge. We'd like to schedule additional transaction...
6
by: Ashok | last post by:
Hi, I am starting a new project to build a software product using APS.NET 2.0. In past I have used "frameset" and "frame" to build pages. My current requirements I have coded using frameset and...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
160
by: raphfrk | last post by:
Is this valid? int a; void *b; b = (void *)a; // b points to a b += 5*sizeof(*a); // b points to a a = 100;
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.