473,786 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ 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 1185
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
2154
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="<% Response.Write (rsUser("Name")) %>"> <% Response.Write (rsUser("Name")) %> <input type="hidden" name="Email" value="<% Response.Write (rsUser("Email")) %>">
2
2534
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 all records and sends each of them ONE BY ONE. After each record that my server script sends, it waits for the client to confirm proper reception with an ACK (binary digit). When there are no more records, my server script sends the client a binary
45
5323
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 similar to the one in any standard C library. <---- Code starts -->
5
7499
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, and changes the iostream to binary like this: cout << "this is text" << eol; binary(cout); cout << "this is binary" << eol; text(cout); cout << "back to text mode" << eol;
6
401
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 of the page of the menu item you clicked. So, for example, if you clicked "About Us", then in the main content div, you would see the content of the about us page. Now, this is pretty simple if the content of a given page is just text (I just...
16
3829
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 log backups. Does that require an exclusive on the database or can the db be used during a transaction log backup? Also, does switching to a bulk mode recovery model before a bulk operation then switching back to full recovery mode after present...
6
1657
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 frame like code below. My question is, because this is a new development is it good to use frameset and frame or I can use some thing better. I am looking for expert suggestions on my code below is this a good way to move or I should not use...
5
5895
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 store a DataTable in any other way outside of our servers. In doing so, we leave ourselves open to large memory requirements. Furthermore, most web pages do not really support multiple changes per transaction. In other words, when the user submits...
160
5717
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
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.