Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Posting (without "contains POSTDATA message)

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
matted
Smarty Rookie


Joined: 18 Apr 2004
Posts: 14

PostPosted: Wed Apr 28, 2004 2:25 pm    Post subject: Posting (without "contains POSTDATA message) Reply with quote

I realize this is not a smarty question, per se, but since I can't find a solution anywhere else, but LOTS of web posts asking about it, I figured I'd try you Smarty veterans and see if anyone has a solution. Please bear in mind I am new to much of this sort of programming, so my stupid factor is large.

The problem:
In mozilla 1.4+, and some other browsers, I'm told, when you try to reload a page with a form, or go back to an immediately previous page that contained a form, you get a message like this:

Code:
The page you are trying to view contains POSTDATA. If you resend the data, any action the form carried out (such as search.. ) will be repeated.  To resend the data, click OK. Otherwise, click Cancel/


I assume this is why most bulletin boards, such as this one, alway go to an intermediate report page that lets the user either navigate back to the previous page, or go somewhere else (like the forum index).

Is there ANY way to avoid this annoying message, without that intermediate page? I've asked some pretty knowledgable programmers, and they just shrug and say "don't use mozilla." That solution is not sufficient. Since I have seen sites where it does not happen, there MUST be a way to prevent it.

Solutions welcome?
Back to top
View user's profile Send private message
matted
Smarty Rookie


Joined: 18 Apr 2004
Posts: 14

PostPosted: Wed Apr 28, 2004 2:31 pm    Post subject: Update on problem and possible solution Reply with quote

Ok.. I just tried some new google words, and found this at
http://www.planetsaturn.pwp.blueyonder.co.uk/backbutton/#Duplicate


Quote:
Duplicate submissions will occur when users refresh an expired POST request, ignoring the browser's warnings, or you have made an incorrect choice of GET request (which the browser assumes to be an 'idempotent' read-only request).

The solution: include a unique identifier or data timestamp in a hidden field on every form. Record the last identifier issued to a given user in a session variable. Warn the user politely when you find a duplicate identifier, or if the data timestamp is inconsistent with the current timestamp. For example; "A duplicate request cannot be accepted, your data has already been processed. Please click here to return to the menu, and try again".


I grasp this conceptually, but can someone show me some code that will actually do this (or some other solution?)
Back to top
View user's profile Send private message
matted
Smarty Rookie


Joined: 18 Apr 2004
Posts: 14

PostPosted: Wed Apr 28, 2004 2:54 pm    Post subject: Update 2 (disabling submit. Only a partial solution) Reply with quote

This is ok, if you want to prevent a duplicate and tell the user you are. But doesnt just prevent the message if the user simply pages back or reloads.

http://www.ewebarchitecture.com/tip.php?id=218
Back to top
View user's profile Send private message
matted
Smarty Rookie


Joined: 18 Apr 2004
Posts: 14

PostPosted: Wed Apr 28, 2004 3:01 pm    Post subject: Clarification of problem Reply with quote

There are two issues. 1) preventing a user from resubmitting, and 2) simply reloading the page when resubmission IS allowed, so simply disabling the form is not good enough. #2 is my problem.

For example, I have a form that writes a file update based on some new input. It can be used over and over again. But every time I submit, i get the Contains post data message. That's what I am trying to prevent. But the submit button still has to work.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP