Jump to content

Disable the AutoComplete


ShadowMage

Recommended Posts

I don't imagine that this is even possible, since I think it's a browser setting. Maybe there's some magic trick to get around it though. I have a table with a grid of input text boxes. I have a script in place to allow navigation of that table with the arrow keys. Problem is when I push the up or down arrow I get a brief flash of a drop down with all the previous values entered in that field. Is there some sort of cache control technique or something to prevent that?I really highly doubt this is possible but I thought I'd ask anyway.

Link to comment
Share on other sites

That kind of stuff is based on the name atrribute, I think. If you use the same name every time, the same info will autofill.Obviously, you want to use name attributes consistently, or getting data out of your $_POST array will be hard.But I wonder if you could tweak those with a random suffix of some kind. Like, have a consistent root for your name attribute, and then tack on 4-8 random characters. Then, when you go to parse the $_POST data, find a way to ignore the suffixes. I can think of a few ways to do it, but I've never actually done it.Just thinking outloud, I guess.

Link to comment
Share on other sites

That's kind of what I have. I have five or six rows of five text boxes. The first row has names like Width1, Width2, etc. The second row has names like Height1, Height2, etc. And so on...The problem I have is this. Say I currently have my cursor in Width2. I have entered values in there previously so when I hit the down arrow to go to Height2 a popup flashes briefly with all previously entered values of Width2. The same thing would occur if my cursor was in Width1, except the popup contains all previously entered values for Width1.

Link to comment
Share on other sites

When I say random, I mean you would generate the name attributes in PHP every time the document is loaded. That way the name is never the same. So I download the document first time, I get this:<input name="address89FD6D">Next time:<input name="addressA6D23B">That part's easy. The trick is parsing the data that gets posted to the server. You could start with $HTTP_RAW_POST_DATA and create a special parsing algorithm that uses regexes to split the base name ("address") from the random suffix ("A6D23B"). Even easier if you use a fixed delimiter between the two parts. Or if the suffix is always the same length, like 6 or 8 characters, then you could just strip the last 6 or 8 characters.I didn't say it would be easy. But it's far from impossible. :)

Link to comment
Share on other sites

Oh, right I see what you're saying now.I did a little bit of quick testing and it doesn't appear to work. I haven't messed with any random suffixes or parsing the names out yet. All I did was manually change the name in my script and reload the page. I did this a couple times and every time I get the popup.Thanks for the help, DD, but this is looking like my suspicions were correct. If you have any other ideas, by all means throw them at me.

Link to comment
Share on other sites

A little experimenting of my own suggests that autocompleters are more sophisticated than I at first imagined. The sort of tweaking I mentioned above led to very inconsistent results. And no doubt the autocompleter algorithms will get even more sophisticated all the time. Surrender seems the appropriate response.

Link to comment
Share on other sites

Note that the autocomplete attribute is not part of the HTML spec, and so implementation cannot be regulated. Use at your own risk.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...