Announcement

Collapse
No announcement yet.

autocomplete off for payment inputs !

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    autocomplete off for payment inputs !

    Apparently all the payment mods are locked down and we have no access to template code for them, eh ?

    I would simply like to add autocomplete="off" so browsers, most all modern ones i think, will NOT store or attempt to autofill or auto guess your credit card number field or CSC field !!!

    Seems like an easy fix to me for the coders to make the edit and push fresh payment mods.

    Otherwise can one of you sharp tools tell me how to implement this guys javascript as in spoon feed me the exact javascript chunk that would work on the payment info page ?

    http://blog.primalskill.com/2007/10/...ml-input-tags/

    I gave it few shots with CARDNUM as the variable but either it just won't work or I'm missing proper syntax somehow.
    <input type="text" name="CARDNUM" size=16 value = "">
    Thanks,
    -Barrett
    Favorite Host Hostasaurus.com
    Order Processing by Shipworks.com
    Kindly Suggesting to:
    *Dump Explorer and http://GetFireFox.com
    *Post a meaningful subject line.
    *Click the # button before pasting code

    #2
    Re: autocomplete off for payment inputs !

    The script you linked to looks for the element via the id. We would need to be able to find the element via its name.

    From what I can see, different payment gateway modules use different names for their fields, so a global fix won't happen. If I get time today, this is a fix I'd like to apply to my sites (which use Authorize.net), so I'll put in some time for a script.

    Comment


      #3
      Re: autocomplete off for payment inputs !

      What I tried was to plug this into the header and also tried in the body with and without the "timer", but then can't code hello world with it...

      (Edit)
      Doh ! I see I think ; we need an ID="CARDNUM" instead of Name="CARDNUM" for the input

      Code:
      <script type="text/javascript">
      var genericAutocomplete = {
      
      off : function(CARDNUM) {
      
      var tag = document.getElementById(CARDNUM)
      
      if (tag) {
      
      tag.value = '';
      
      }
      
      } //end of turnOff
      
      } //end of genericAutocomplete
      
      To load this after the page is rendered we call the setTimeout function like this:
      
      window.setTimeout("genericAutocomplete.off('CARDNUM')",50);
      
      </script>
      Last edited by Barrett; 11-14-08, 07:29 AM.
      Thanks,
      -Barrett
      Favorite Host Hostasaurus.com
      Order Processing by Shipworks.com
      Kindly Suggesting to:
      *Dump Explorer and http://GetFireFox.com
      *Post a meaningful subject line.
      *Click the # button before pasting code

      Comment


        #4
        Re: autocomplete off for payment inputs !

        The script you posted is very odd. All it does is reset the value of the field to empty when the page loads. This is (I guess) targeted at users who have an autofill toolbar or whatever. Not to thread hijack, but that's not a feature I'm worried about.

        What I wanted, was a way to turn off the autocomplete dropdown box that saves previous credit card numbers and information. When we place phone orders, and we click on the credit card number field, we can see all of the previous credit card numbers (nasty for any shared computer). Since this is a feature I've wanted for awhile, I took the time to write it today. This is my first draft, so consider it a beta with no guarantees:
        Code:
        <script type="text/javascript">
        	var killAutocomplete = {
        		off: function(eleName_prefix) {
        			var inputs = document.getElementsByTagName('input');
        			for ($i=0; $i<inputs.length; $i++) {
        				if (inputs[$i].name.substr(0, eleName_prefix.length) == eleName_prefix) {
        					inputs[$i].setAttribute('autocomplete', 'off');
        				}
        			}
        		}
        	};
        
        	window.setTimeout("killAutocomplete.off('AuthorizeNet')",50);
        </script>
        Script explanation:
        killAutocomplete.off() takes a string param "eleName_prefix". This param is used as a search to go through all of the input fields and add the autocomplete="off" attribute to fields that start with the given param. By disabling the autocomplete feature before the form is submitted, the browser is instructed not to save the information at all, so instead of being retroactive, this is actually proactive! The example code I posted works with the Authorize.net payment module. To find out what your param should be, you have to look at the page source on the OPAY screen to see what your fields start with.

        This code should be compatible with any payment module as long as their naming conventions match Authorize.net's. If they do not, you can always put the entire element name in the param. So far I've tested with FF2 and 3, IE 6 and 7 and Safari Windows.

        Comment


          #5
          Re: autocomplete off for payment inputs !

          Possible (untested) for Payflow:
          If you wanted to disable autocomplete on all 3 fields, you could use this:
          Code:
          <script type="text/javascript">
          	var killAutocomplete = {
          		off: function(eleName_prefix) {
          			var inputs = document.getElementsByTagName('input');
          			for ($i=0; $i<inputs.length; $i++) {
          				if (inputs[$i].name.substr(0, eleName_prefix.length) == eleName_prefix) {
          					inputs[$i].setAttribute('autocomplete', 'off');
          				}
          			}
          		}
          	};
          
          	window.setTimeout("killAutocomplete.off('CARDNUM')",50);
          	window.setTimeout("killAutocomplete.off('EXPDATE')",50);
          	window.setTimeout("killAutocomplete.off('CSC')",50);
          </script>
          If you only care about cardnum, you can delete the last two window.setTimeouts().

          Comment


            #6
            Re: autocomplete off for payment inputs !

            Originally posted by Brandon MUS View Post
            Possible (untested) for Payflow:
            If you wanted to disable autocomplete on all 3 fields, you could use this:
            Code:
            <script type="text/javascript">
                var killAutocomplete = {
                    off: function(eleName_prefix) {
                        var inputs = document.getElementsByTagName('input');
                        for ($i=0; $i<inputs.length; $i++) {
                            if (inputs[$i].name.substr(0, eleName_prefix.length) == eleName_prefix) {
                                inputs[$i].setAttribute('autocomplete', 'off');
                            }
                        }
                    }
                };
            
                window.setTimeout("killAutocomplete.off('CARDNUM')",50);
                window.setTimeout("killAutocomplete.off('EXPDATE')",50);
                window.setTimeout("killAutocomplete.off('CSC')",50);
            </script>
            If you only care about cardnum, you can delete the last two window.setTimeouts().
            Excellent Brandon !

            Tested good for me with Verisign Payflow Link mm5.5
            Last edited by Barrett; 11-14-08, 09:49 AM.
            Thanks,
            -Barrett
            Favorite Host Hostasaurus.com
            Order Processing by Shipworks.com
            Kindly Suggesting to:
            *Dump Explorer and http://GetFireFox.com
            *Post a meaningful subject line.
            *Click the # button before pasting code

            Comment

            Working...
            X