[FX.php List] Problem with double submissions
Andy Gaunt
andy at fmpug.com
Mon Sep 27 09:31:05 MDT 2010
Hey Bob,
Why not disable the button instead?
You can do this with jQuery if you are using it or just adding an onClick to the element
onclick="this.disabled=true;"
jQuery might look like:
$('#yourform').submit(function(){
$('input[type=submit]', this).attr('disabled', 'disabled');
});
You could also change the value of the submit button to "Processing..." or something similar as well to give the end user some feedback that the page is working
HTH
Andy Gaunt
T: 321-206-3658
andy at fmpug.com
http://www.fmpug.com
FMPug.com: A Developer's best Friend!
Follow us today at http://twitter.com/fmpug
FindFileMakerDevelopers.com - The #1 listings engine for FileMaker Professionals
Follow us today at http://twitter.com/findfmdevs
On Sep 27, 2010, at 11:09 AM, Bob Patin wrote:
> 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
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100927/9f6fb93b/attachment-0001.html
More information about the FX.php_List
mailing list