Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Separation between View and State (The Back Button)

Reply
Thread Tools

Separation between View and State (The Back Button)

 
 
Michael B Allen
Guest
Posts: n/a
 
      07-13-2006
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

 
Reply With Quote
 
 
 
 
Vincent van Beveren
Guest
Posts: n/a
 
      07-13-2006
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hello ghouliana separation of church and state duckstandard Computer Support 0 08-22-2010 04:49 AM
difference between asp session state and asp.net session state. archana ASP .Net 0 03-13-2007 11:42 AM
BaseHTTPServer and priviledge separation? Helmut Jarausch Python 1 06-25-2005 03:48 PM
How to make a week view and day view calendar just like month view calendar in .NET ? Parthiv Joshi ASP .Net Web Controls 1 07-06-2004 03:15 PM
Question on view and code separation Wayne Liu ASP .Net 0 07-25-2003 05:26 AM



Advertisments