473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

resending GET every time... BAD

Hi there-

I have a web application to maintain and one of the problems I am
dealing with is this:

1) user arrives at a page (URL=A) and it displays a list of stuff.
2) User clicks submit on a form pertaining to an item in the list.
2) Form is submitted, server performs operation, server sends back
same page with updated data.(URL=B)
3) User clicks reload
4) The form is submitted again (thanks to URL B), server tries to
perform same operation and fails.

Now I could use a POST, but then I'd get that annoying resubmit post
dialog and that's just as bad. I've seen stuff like, "DO NOT CLICK
THIS BUTTON MORE THAN ONCE" warnings before, but that won't fly with
my boss.

I know what the problem is, the URL is altered after I submit (which
includes a command that tells the server what action to perform).
When they reload, URL B is reissued. I need to replace URL B with the
original URL A. then the problem becomes, how do I save URL A int he
first place?

How can I get the form to submit only once?

thanks!
troy
Jul 20 '05 #1
3 1612
Troy wrote:
Hi there-

I have a web application to maintain and one of the problems I am
dealing with is this:

1) user arrives at a page (URL=A) and it displays a list of stuff.
2) User clicks submit on a form pertaining to an item in the list.
2) Form is submitted, server performs operation, server sends back
same page with updated data.(URL=B)
3) User clicks reload
4) The form is submitted again (thanks to URL B), server tries to
perform same operation and fails.

Now I could use a POST, but then I'd get that annoying resubmit post
dialog and that's just as bad. I've seen stuff like, "DO NOT CLICK
THIS BUTTON MORE THAN ONCE" warnings before, but that won't fly with
my boss.

[snip]

The problem is that you have ignored section 9.1 of RFC 2616 (the HTTP 1.1
specification).

"In particular, the convention has been established that the GET and HEAD
methods SHOULD NOT have the significance of taking an action other than
retrieval. These methods ought to be considered "safe"."

-- <URL:http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1>

A common way of constructing an interface like this is to have two files, a
'view' and a 'controller'. The view grabs the information out of the
database or wherever, and displays it to the user. That is all. The
controller updates the database and redirects to the view. That is all.

Now you can use POST with the forms, and the only page the user will attempt
to reload is the view page, which is now safe. If by some chance the user
does attempt to reload the action page, they will get a warning off their
browser (as they should). The warnings of common browsers aren't very
clear, but usually people figure out enough to hit cancel and then the back
button.
--
Jim Dabell

Jul 20 '05 #2
"Troy" <tr**@morpheus.net> wrote in message
I know what the problem is, the URL is altered after I submit (which
includes a command that tells the server what action to perform).
When they reload, URL B is reissued. I need to replace URL B with the
original URL A. then the problem becomes, how do I save URL A int he
first place?

How can I get the form to submit only once?


This is more of a server-side programming issue and you may have better luck
in a forum that deals with the language you're developing in.

My thought is, URL B should be able to render with only the information that
appears in the querystring. If there's a form on the page that a user can
resubmit, you should be able to recreate it to contain the values that would
have been used before the user submitted it (URL A).

If the issue is that once URL A is submitted, it performs an action that
should only happen once (e.g: charging a credit card) then you'd need to
track whether that particular user (using a session id) has already
performed the action before performing it again.

Good luck,

Jonathan
--
http://www.snook.ca/
Jul 20 '05 #3
In article <MG**********************@news01.bloor.is.net.cabl e.rogers.com>, one of infinite monkeys
at the keyboard of "Jonathan Snook" <go***************@snook.ca> wrote:
This is more of a server-side programming issue and you may have better luck
in a forum that deals with the language you're developing in.


Indeed, ISTR putting it in the FAQ for that group some years ago.

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bill Cohagan | last post by:
I'm constructing an ASP app with a frameset on the home html page. From frame A I need to referesh the page in frame B when a button click occurs on a button in Frame A (server side event handler)....
4
by: jonceramic | last post by:
Hi guys, I have a user who wants to have a report that shows only the 10th value recorded by his equipment. (i.e. His equipment records temperature every 30 seconds, but he only wants to view...
1
by: ABCL | last post by:
Hi I have aspx page that has a html link on it( <a href="javascript:window.open('xxx.aspx')";..) When I click this link If should open new window usng javascript, But it gives me a message...
3
by: palepimp | last post by:
Hello all, I have searched far and wide for a solution to my issue. In short, here is the problem: 1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007...
0
by: feltra | last post by:
Hi all, I am trying to export a GridView data to multiple file formats. The requirement is that when more than one file format is selected and the "Submit" button is clicked, the data from the...
1
by: phpmel | last post by:
"the page cannot be refreshed without resending the information".....This is the Internet Explorer Message i get before the info is sent all over again Is this always true or can we add some php...
0
by: alivip | last post by:
I write code to get most frequent words in the file I won't to implement bigram probability by modifying the code to do the following: How can I get every Token (word) and ...
2
by: Derik | last post by:
I've got a XML file I read using a file_get_contents and turn into a simpleXML node every time index.php loads. I suspect this is causing a noticeable lag in my page-execution time. (Or the...
4
by: Frank Lund | last post by:
Should we call .Dispose() every chance we get... on every object that exposes .Dispose()... and every time we have such an object? For example, is it true that *every* time I create a DataTable...
1
by: OBAFGKM_RNS | last post by:
In my html, I have an embedded sound wav. I access that sound from my javascript using Play() and Stop(). However, once stopped, the sound will aways resume from where it left off, (making Stop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.