Clodoaldo
clodoaldo.pinto.neto at gmail.com
Tue Mar 20 14:04:35 EST 2007
2007/3/20, Kenneth Loafman <kenneth at loafman.com>: > Clodoaldo 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. > > What I am doing is this: > > def regen_plot(req): > <plot logic snipped> > return """\ > %s > <div align="center"> > <a href="/demo/index/display_hit"> > <img src="/demo/%s.gif" ismap border=0></a> > <p>X range is %d through %d seconds</p> > </div> > %s > """ % (_head, dbname, xrng[0], xrng[1], _tail(req)) > > Then when the user hits a point on the plot, display_hit is called. I > translate the x,y args from the URL into plot space, center the point > around a smaller region, and plot again. Going forward, it all works. > Session() vars work, but since I'm not in a form, and there's no submit > button, the hidden values don't work. req.form.get('x') fails. > > Is it possible to get <form> to use an <img ... ismap> tag in lieu of > the submit button? I don't know. What if you just set the the values in the URL? This way the user could even bookmark each frame of his interest.: > <a href="/demo/index/display_hit?var_1=99.9&var_2=33.3"> -- Clodoaldo Pinto Neto
|