Question

I have a following scenario:

First webpage has a form which does submit to the server. Server responds with second page. The second page has a hidden form which is being submitted using javascript on form load, it redirects user to an external site.

My question is: Is it possible for the user to double submit the second form doing form submit on the first page twice (within one page view of the first page)?

The question relates to how this would work in practice, I don't need alternative scenarios.

Was it helpful?

Solution

I'll ignore the fact that practise shouldn't be used as a production solution.

What you're asking cannot occur if the users browser has not executed the second form's onLoad() javascript event.

As with any solution like this you can never be 100% sure how a client browser behaves when two events occur near simultaneously, but I would say in most cases a browser will not execute the onLoad() event twice.

What you do need to be careful of is the browser's back button behaviour. That could definitely cause a resubmission.

OTHER TIPS

No, even if the first form got double-submitted, the second form would be loaded only once.

It is not possible that second form will send twice. Because of the redirect to another page where everything is loading from scratch.

I'm not sure if your approach to the problem is right, though you are not asking about that, please keep in mind that user can click button several times with cmd/ctr button and open new page with form many times in new tabs. In this case your form will be submitted more then once.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top