Re: Re: Re: Prevent multiple clicks of submit order

Posts: 5357
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

So... I change line 1623 in uc_cart.module from:

<?php
  $form
['submit'] = array('#type' => 'submit', '#value' => variable_get('uc_checkout_submit_button', t('Submit order')));
?>

To:

<?php
  $form
['submit'] = array(
   
'#type' => 'submit',
   
'#value' => variable_get('uc_checkout_submit_button', t('Submit order')),
   
'#attributes' => array('onclick' => '$(this).click(function() { return false; });'),
  );
?>

When someone clicks the button, it will get a new onclick function that returns false, thereby canceling any duplicate form submissions. My only question is what if there is a timeout or something else? Then they'll sit there click "Submit Order" over and over with no result.

Any thoughts? Should I keep this mod?

Prevent multiple clicks of submit order By: txcrew (12 replies) Fri, 03/21/2008 - 20:32