We have been doing extensive research into this issue. The issue is more complex than it might seem. This is because:
- Any JavaScript-based solution is useless if the page is reloaded.
- According to our research, the problem is not that the customer stays on the payment page and clicks on the button twice, since in most cases the page immediately changes to the processing page (e.g. often an empty page while communicating with the payment gateway). Rather, we believe that the following is more likely what happens:
- there is a delay in the processing of the transaction
- the customer believes that nothing is happening
- the customer clicks on the "Back" button to return to the payment page (the payment form is reloaded)
- the customer resubmits the payment form (the order ID is the same, but this is a new transaction)
- If this is the case, disabling the submit button is not going to help.
Preferred Solution For all payment gateways where the payment form submits to the same page (e.g. gwAuthorizeAIM.asp), we believe the best way to go is to set a session variable when the form is submitted. The submit button would then be hidden on the payment form if the session variable has a certain value. The variable would be cleared before showing a "transaction denied" message (e.g. the credit card has expired), so that in those scenarios the payment form can be resubmitted (on gwAuthorizeAIM.asp, the session variable would be cleared before redirecting to "msgb.asp").
We are investigating the best way to implement this idea.
Disabling Image Button That said, we would also like to provide an easy way to disable the submit image button for those who want to implement this code on their own right away. The following JavaScript works on all browsers except for Safari on the Mac.
This code can go anywhere before the image button:
<script type="text/JavaScript"> <!-- function DisableSubmitButton(sbtn) { sbtn.disabled=true; sbtn.form.submit() } //--> </script>
On the image button itself, you would then add the following onClick statement:
onClick="DisableSubmitButton(this)"
We will be back with more information on the Preferred Solution mentioned above. We are interested in hearing your thoughts, if you have any.
------------- The ProductCart Team
Home of ProductCart http://www.productcart.com" rel="nofollow - shopping cart software
|