Reputation: 69
I was wondering if there is any way to disable autofill for credit card information. As I'm aware the autocomplete"off"
attribute does not work for CC options. I also tried to use: autocomplete="doNotAutoComplete"
.
Currently the textbox looks like this:
<asp:TextBoxID="_creditCardHolderNameTextBox"runat="server" MaxLength="100"/>
I've thought of two common solutions for the problem, renaming the ID to something random that Chrome can't pick up, however I don't want to do this for two reasons: 1) It's just bad practice 2) There are a lot of things in the code using this textbox and renaming it all causes heaps of errors and gets extremely messy really quickly.
The other thing was creating "Fake" CC Inputs as mentioned by Mike Nelson this post: Disabling Chrome Autofill
The only problem with this is the code I'm currently working with uses a repeater to generate the form, it's also extremely messy and volatile messing with it.
Any ideas?
Upvotes: 2
Views: 659
Reputation: 69
UPDATE: In case anyone was wondering I found out a couple of solutions to this problem.
Google defines that the fields are Credit Card inputs by the following factors: The label Proceeding the input, the id of the input and the name attribute (if applicable).
So in short the quickest and most simple solution is to just change the id, name and label to something unrelated to the CC details.
For the label I found the easiest solution to be to wrap a label around each word e.g.
<label>Credit</label> <label>Card</label> <label>Number:</label>
(Very sloppy solution but gets the job done)
The second problem is the id and name, for this I found the best solution to be to use a script that changes these dynamically then passes them back before submission of the form. Check out this awesome Jquery script by Terry Lin (terrylinooo) which does just that!
https://terrylinooo.github.io/jquery.disableAutoFill/
Upvotes: 1