Form resubmission issue-Django html
There is a form ,which is submitted and then the page is redirected to another page.But if the user hits the refresh button again on the new page .the following message is displayed
To display this page, Firefox m开发者_开发百科ust send information that will repeat any action (such as a search or order confirmation) that was performed earlier.
And on press "OK"
A duplicate entry is created how do i prevent this or how do i handle this
I am using a django,application
Thanks..
I would double check your sequence of events because it seems like something is off.
It sounds like you're processing the post data, then returning an HTTP response rather than a redirect. When your user refreshes the page they resend the POST data.
I'm wondering where and when are you processing the POST data and if you're correctly redirecting.
The page that the form submits to should process the POST data and create an entry (sounds like that is working).
If you want to avoid having the double post issue on a successful submission it's best to redirect to another page AFTER you've processed the data and successfully saved.
This will not pass the POST data to the new view, and the user can refresh the page to their hearts content without having to worry about double submissions.
精彩评论