Skip to main content
Known Participant
September 18, 2008
Question

Back button - do not disable

  • September 18, 2008
  • 2 replies
  • 466 views
I have a form with a predisplayed line item number, in this case 1, to start off. There is a checkbox to add another line item, so if they check the box and fill out the form and submit, it brings up the form again with line item 2 (continuous increment by 1 if the box is checked). If they fill out the form again and do not check the add another line item box, the form submits and goes to another page with a popup message indicating a successful transaction.

Here is the problem. On the message page, if they hit the back button on the browser, it goes back to the form, with line item 2 (which was already submitted). If they submit again, line item 2 will be written to the table again, and there can only be one line item.

If I make the line item a unique key in the table, the application will just blowup. Can it display a nice error message about duplicate line items ?

My other option would be to use javascript to disable the back button, but everyone says that is not recommened.

If that is the case, what do I do to avoid this situation ?

The sequence of events/screens works properly, but as soon as they use the back button, that is where I run into problems.
    This topic has been closed for replies.

    2 replies

    Inspiring
    September 19, 2008
    If you disable caching, and they go back to it, it won't come up. They'll have to refresh it in which case they get the page they started with, not the one they submitted.
    Inspiring
    September 18, 2008
    You could always disable caching on the form page.
    Known Participant
    September 18, 2008
    If I disable caching on the form page and they hit the back button to go back to the form page, what line item value would be displayed ?

    Ideally, if it was 2 and they hit the back button, the next value would be three.

    Disabling cache, cookies, and sessions was suggested by coworkers, but nobody could figure out how to get the next value in there.