Page 1 of 1

BACK Button Blues

Posted: Thu May 08, 2008 4:55 am
by coderb
Hi All,

I know the back button is the cause of many headaches, and now it's mine. My pain is this:

I have a self posting page containing - a list of results and a form (method=get) for search criteria. This form also has a button that allows users to update all result rows to a certain status. I do this by simply adding a querystring value which if set is applied to each row before page build.
Okay, so my problem is this.
User clicks the button to update the status of all rows, the update is fine and the page is rendered with new status. Bear in mind the querystring value is still set for this update.
User then clicks a button to view the details of a result row. On the detail page they can update the status again to any value (which they do).
User then hits the back button to view the list again, hits refresh to see the updated status (as changed on the detail page).
But of course the querystring is still set with the value to run the status update and therefore cause overwrite of status changes made on the detail page.

So what I tried was this:
on the self posting page, add another small form that contains the button which updates the status. This form is method=post. that means I do away with having that value in a querystring. Of course the post value is still there after user hits the back button, but at least this time they get the standard browser pop-up message that warns them that the page contains postdata and OK / CANCEL option to avoid resend of data.

Of course this far from full proof , the average user is just gonna hit OK.

So, what do I do?
Can I clear the post data on a page after executing the portion of code that uses it?
any help appreciated.... thanks.

Re: BACK Button Blues

Posted: Thu May 08, 2008 5:32 am
by EverLearning
After updating the status do a header redirect

Code: Select all

header('Location: ' . $resultsUrl);
 
to the list of results. That way, when user hits back from the row details page, he won't be presented with a popup asking if he wants to resubmit POST data.

Re: BACK Button Blues

Posted: Thu May 08, 2008 7:07 am
by coderb
hi,
thanks for the tip, it would work, I guess I just need to build an array of results to pass to the action script so that it know which rows to update.
thanks,