[FX.php List] Problem with double submissions

Bob Patin bob at patin.com
Mon Sep 27 09:09:09 MDT 2010


I've got a problem with a client's web server that sometimes slows down so much that customers are double-submitting their orders, causing their card to get hit twice.

Here's what *should* happen on a well-behaved web server:

Page submits, Authorize.net runs the charge, order gets updated in FileMaker with the transactionID.
Customer goes to the confirmation page, where they see a printable invoice
Session variable gets destroyed

BUT HERE'S WHAT HAPPENS:
The web server, for which I have no control and no faith, seems to time out sometimes on this page, where auth.net processes the card.

I've been trying to write a Javascript function to prevent double submissions; here's what I'm trying:

On my button, which is an image, I have this:

<input type="image" name="mySubmit" src="images/process_cc.jpg" alt="ticket_cc_process.php" width="180" height="32" onclick="javascript: return check_submit();">

Then, here's my JS function:

<script language="Javascript">
function check_submit (){
	if (document.form1.form_submitted.value == 1){
		alert("Don't submit twice. Please wait.");
		return false;
	}else{
		document.form1.form_submitted.value = 1;
		return true;
	}
}

</script>

So my problem is that I can't get the form to time out, giving me enough time to see whether this actually works--customers seem to be able to, but not me.

QUESTION:
Is there a better way to do this, better code, better method?

Thanks,


Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
iChat: bobpatin
FileMaker 9, 10 & 11 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
Expert FileMaker Consulting 
FileMaker Hosting for all versions of FileMaker
PHP • Full email services • Free DNS hosting • Colocation • Consulting

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100927/f07b7a38/attachment.html


More information about the FX.php_List mailing list