Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 01-31-2005 19:23:21

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Stop Repeated Form Clicks *transparently*

**Now I have not got much experience at Javascript and browser compatibility so use this at your own risk**

If anyone has any knowledge in Javascript and browser compatibility please do add to this topic anything we should know about this script I have 'bodged' together. However, it seems to work great on my browser which is IE 6.0

I was searching for a script that could prevent customers from clicking the form submission buttons more than once and do it transparently. No alert boxes or daft messages. Something simple and clean.

I have noticed in testing my shop site on net novices they don't understand that sometimes pages take a while to load occasionally and so they click... a lot! This is a bad bad thing when it comes to the checkout area especially.

I found this existing idea here but it just wouldn’t work for me no matter how much I fiddled with it:

Anyway here’s my the code (could someone please verify for me this is ok to use and if it works with a wide selection of browsers):


I placed this in the  of the  element:

Code:

<script language=JavaScript>
var submitcount=0;
function checkFields() {                     
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      return false;
      }
}
//  -->
</script>

As this script is now in the head of your site layout HTML you can then simply 'call' it from any form anywhere in your site by simply placing the following in a forms HTML :

Code:

onSubmit="return checkFields()"

For example:

Code:

<FORM METHOD="POST" onSubmit="return checkFields()" ACTION="(CGIVAR)common_url_form(/CGIVAR)">

This code seems to work flawlessly for me. The customer clicks once, the form is submitted, while the page is 'doing its thing' the new-to-the-internet customer continues to click like a loony yet they are all ignored and the page just continues calmly.... bliss!!  ;-)

So if you can please do let me know if I am using something I shouldn't be or if this really is the answer to this problem.

Thanks all!

Mike


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#2 02-22-2005 15:24:41

doubledome
Member
Registered: 09-24-2003
Posts: 83
Website

Re: Stop Repeated Form Clicks *transparently*

Has anybody check this code or implemented something similar? We've just see an increase in the number of people that click the submit button two times.

This is really messing things up. The first order is approved at the processor, but the second submit creates a "fraud-duplicate order" transaction. Since this happens before the processor sends a confirmation back to ccp the user thinks the order failed. The ccp order emails are never generated, but the first transaction is charged to the customers card.

Any help on this would be greatly appreciated!


cab713

Offline

 

#3 02-25-2005 00:39:11

Steven
Member
Registered: 04-21-2004
Posts: 84

Re: Stop Repeated Form Clicks *transparently*

Simply put a message right underneath the button that says

"Please push only once otherwise you will be charged twice"

Offline

 

#4 02-25-2005 20:22:05

Shawn
Member
Registered: 09-24-2004
Posts: 216

Re: Stop Repeated Form Clicks *transparently*

I've recently had some orders where the customer hit the submit button more than once.  I have implemented this and it seems to have solved the problem.

I think this is a great solution to a problem with customers who keep clicking the submit button.  I added an alert to the javascript which pops up an alert box.

I placed this code in the ste_layout.txt file between the <head> and </head> tags

<script language=JavaScript>
var submitcount=0;
function checkFields() {                     
  if (submitcount == 0)
     {
     submitcount++;
     return true;
     }
  else
     {
alert("This form has already been submitted.  Thank You!");
     return false;
     }
}
//  -->
</script>


Then right under the <body> tag I placed this:

<FORM METHOD="POST" onSubmit="return checkFields()" ACTION="(CGIVAR)common_url_form(/CGIVAR)">

This seems to work great!

I have tested this in:
Internet Explorer ver. 5.5 and 6.0
Opera ver. 7.54
Mozilla Firefox ver. 1.0
Netscape ver. 7.2


Many thanks to Mike (mygee)!!!!!

Offline

 

#5 02-26-2005 11:24:40

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

Nice work Shawn   :-)

Glad this is of use to some of you.

My store is not live yet as such but I have kept this code in the site and it has worked flawlesly so far.


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#6 02-27-2005 10:18:48

Big Dave
Member
Registered: 10-24-2003
Posts: 742

Re: Stop Repeated Form Clicks *transparently*

If you use Paypal as one of your payment options, DO NOT use this script.

I installed it yesterday and lost 9 (all paypal) sales until someone finally notified me of the problem. I removed the script, and paypal works fine again. Weird.

What a shame too, because the script worked great for the problem with which it was intended.

Offline

 

#7 02-27-2005 13:44:05

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

Thanks for pointing that out Big Dave. Thats a serious issue indeed. Sorry that you lost those sales.

Does anyone know why this may be conflicting with PayPal? and does anyone know of a work around or another script that does the same job but without any issues?


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#8 03-03-2005 12:15:02

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

I'd just like to quickly add that I have now done testing on my site with this script and using PayPal and have had no problems at all. Not sure why its not working for Big Dave and his PayPal but I guess the moral of this story is... try it out if you need this script but check it out for sure as well!!  :-) 


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#9 03-03-2005 13:56:05

Big Dave
Member
Registered: 10-24-2003
Posts: 742

Re: Stop Repeated Form Clicks *transparently*

I would just like to add that I had two others try this on their CCP sites, and they had the exact same problem with paypal payments.

Very strange indeed.

Offline

 

#10 03-03-2005 15:32:49

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

Hi Big Dave,

That is really stange indeed as I don't seem to be getting any errors. May be its to do with with my browser.

What are the browser types and versions that you are using with this script when getting the errors?

What exactly happens when you implement this script? ...does CCP simply not pass the customer over to PayPal successfully?

Cheers


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#11 03-03-2005 17:00:09

Big Dave
Member
Registered: 10-24-2003
Posts: 742

Re: Stop Repeated Form Clicks *transparently*

I am using IE 6, and when I put the code in it brings me to the main page.
When I take the code out, it goes to paypal just fine.

Offline

 

#12 03-03-2005 18:02:19

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

Cheers for the info Big Dave.

V strange... hmmm

I'm using IE6 as well on M$ XP SP2 and it goes through ok.

I'm going to try and test it on some other systems.

Will post back what I find for the reference of others...  smile 


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#13 03-03-2005 22:34:55

Shawn
Member
Registered: 09-24-2004
Posts: 216

Re: Stop Repeated Form Clicks *transparently*

Hi, I had the same results as BigDave, the script worked great except for Paypal.
I tried many variations of "submit once java scripts", but could not get any to work.

This mod probably needs to be implemented in the checkout script instead of Java.
I know that paypal requires a direct form call:

<FORM METHOD="POST" ACTION="https://www.paypal.com/cgi-bin/webscr">

This is called from the ste_gw_paypalpp element, but then again all of the payment processes are called from the ste_gw elements.

Anyway, I also lost some paypal sales from this so I pulled the script.
Thank You BigDave for the heads up, it may have been some time before I noticed
this.  The other problem is that there are still people who keep banging away on the submit button, and the number of clicks probably goes up as thier internet speed goes down.

Nick, we would love some assistance on this one!

Shawn

Offline

 

#14 03-04-2005 05:34:47

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: Stop Repeated Form Clicks *transparently*

Cheers for the info Shawn.

My PayPal Form TAG contains the  PayPal URL:

<FORM METHOD="POST" ACTION="https://www.paypal.com/uk/cgi-bin/webscr">

I wonder if this is why it works for me? ...I would be surprised if it was though!

Either way I'm going to pull the JavaScript from my site to be on the safe side. The thing is I think we all really do need something to this effect in place. The amount of 'payment pending' orders that are redundant from the cart abandonment’s can be enough without additional redundant 'payment pending' orders from the repeat submit clicks!!

Mr.Webmaster... Nick... any ideas???  smile


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

Board footer