Separation between View and State (The Back Button)

Discussion in 'Javascript' started by Michael B Allen, Jul 13, 2006.

  1. 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
     
    Michael B Allen, Jul 13, 2006
    #1
    1. Advertising

  2. > 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
     
    Vincent van Beveren, Jul 13, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wayne Liu

    Question on view and code separation

    Wayne Liu, Jul 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    351
    Wayne Liu
    Jul 25, 2003
  2. sylvia sil
    Replies:
    1
    Views:
    638
    Curt_C [MVP]
    Dec 29, 2004
  3. Helmut Jarausch

    BaseHTTPServer and priviledge separation?

    Helmut Jarausch, Jun 25, 2005, in forum: Python
    Replies:
    1
    Views:
    322
    Lee Harr
    Jun 25, 2005
  4. noone
    Replies:
    4
    Views:
    288
    noone
    Jan 23, 2007
  5. Parthiv Joshi
    Replies:
    1
    Views:
    768
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page