[mod_python] Detecting Back Button Usage

Bart scarfboy at gmail.com
Tue Mar 20 11:11:19 EST 2007


Indeed. To solve this, you need to remember past states
one way or another.


In one administration interface I've seen, state is remembered
server-side for... I forget whether it was a number of actions or
some time.

It involved an identifier for each served page, which means you
can actually *know* when a user submits something from a page
displaying old state, and decide to either
* set the new state as the displayed state+the change requested
* set the new state as the current state + the change requested
  (often unpredictable)
* complain "hey, you tried to alter from an old state!"
* complain "hey, you tried to alter from an old state!", view the
  current, and ask whether you still want to apply the changes,
  to *that*. This is the user-friendliest if the last option may throw
  away ten minutes of user work.


The idea of using AJAX to essentially imitate MVC is probably a
workable one too, (though I still haven't checked whether there is
a simple way of checking use of the back button through
(ajax-less) client side scripting)
If you do this, be sure to also give sane fallback behaviour to
people with scripting disabled.

--Bart




On 3/20/07, Clodoaldo <clodoaldo.pinto.neto at gmail.com> wrote:
> 2007/3/20, Kenneth Loafman <kenneth at loafman.com>:
> > I'm using mod_python under Ubuntu Edgy 64, doing some basic plots of
> > data and allowing users to select a point to center on a region and gen
> > the next plot.  All of that works as long as the user moves forward.
> > The problem comes in the use of the back button.  The browser merely
> > displays the last page rather than rebuilding it, or at least restoring
> > the variables.  This leads to a lot of confusion because the server is
> > on one set of plot values and the browser is now on another.  This seems
> > to be a common problem.  Is there a solution, or should I just warn the
> > user not to use the browser back button?
>
> How does the user select the point? Entering it in a form field? If so
> save the plot values (the page state) on the page using a hidden field
> inside the form:
> <input type="hidden" name="variable_1" value="99.9">
> <input type="hidden" name="variable_2" value="33.3">
>
> When the form is submitted those values will be available to your script.
>
> If you are using some Ajax scripting to let the user select the point
> then adapt it to also send the current page state.
>
> I could not find the correct words to google. It would be something
> like "page state maintenance in HTML (or HTTP)". Can someone create
> the correct search words?
>
> Regards,
> --
> Clodoaldo Pinto Neto
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list