473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Separation between View and State (The Back Button)

Let's say you have a "Buy" botton that posts a form to a script that
inserts or increments the quantity of a record in a shopping cart
table. So you click "Buy" and then "Checkout". Now if you hit the Back
button it asks the user if they would like to repost the form. If they
click "Ok" the db script runs again and now they have two items in
the cart.

It seems to me this is a fundamental model view controller kind of
problem. There's no seperation between the view and the controller. Can
someone recommend a generic method for providing that seperation? I could
have the script emit a Location header but that's a strange hack. What
is the definitive method for solving this probably very common issue?

Thanks,
Mike

Jul 13 '06 #1
1 1240
It seems to me this is a fundamental model view controller kind of
problem. There's no seperation between the view and the controller. Can
someone recommend a generic method for providing that seperation? I could
have the script emit a Location header but that's a strange hack. What
is the definitive method for solving this probably very common issue?
I don't see how JavaScript would solve this problem. Generally you'd do
a redirect after a submit. Because the redirect is not a POST the
browser forgets the post. Doing a back will cause you to go back to the
page which was requested with a GET, thus no repost. I think you can
better ask this question on a server-side-something form, like Servlets,
PHP or ASP.

Cheers,
Vincent
Jul 13 '06 #2

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

Similar topics

1
by: David | last post by:
hello to all... i've one more question... how to make listview to enter to "label edit" state... -- let say, user of my program click on "rename item" button, and focus sets to list view item, to...
6
by: Robert W. | last post by:
I'm building my first major C# program and am try to use best practices everywhere. So I've implemented the "Document/View Model" whereby: - There's a Windows Form, which we'll call "formView" -...
0
by: Eran Amitai | last post by:
I have the simplest web page (using code-behind): <body> <%# MyText %> two buttons - button1 and button2 </body> My code-behind web page is very simple too: public class WebForm3 :...
3
by: Philip Tripp | last post by:
I've read numerous sources stating that view state can be disabled per control, and per page, but can't seem to keep web form controls from remembering their state on a postback. I'm using VS.Net...
4
by: Souri Challa | last post by:
Hello All, When a datagrid in a web form is getting re populated from view state on post back, it is firing the datagrid Item Created event but the DataGridItem(e.Item.DataItem is null) in the...
6
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common...
7
by: Tom wilson | last post by:
I have created a very simple example that doesn't work. Form1 contains a textbox and a button: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
3
by: Neven Klofutar | last post by:
Hi, I recently read an article on MSDN about viewstate and postback. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/viewstate.asp The author states the following:...
3
by: gaDev | last post by:
1) I build a Html Table dynamically (Header Row, and then 2 rows with data All 2 rows have 2 cells: cell(0) contains a delete button (ASP Button), cell(1) contains a HTML Text box 2) On Form Load...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.