How do you turn off auto-complete for forms on the server-side?

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
Jan 2, 2006
10,455
35
91
My clients are Realtors. I provide photography for them. I have them fill out an order submission form in which I ask for the address of the house that they want us to photograph.

Unfortunately, they're not the most detail-oriented bunch of people. Most of the time they put in their name, their browser auto-fills the fields with the address of their OFFICE or their own PERSONAL HOME, NOT the address of the house they're selling, and they press submit without a second thought.

Even after 3 confirmation emails in which the erroneous address is clearly visible, we don't find out that it is the address to their office or personal home until our photographers are already AT the location.

How do I disable auto-complete on my form? It needs to be disabled for any browser they may be using.
 
Last edited:

RampantAndroid

Diamond Member
Jun 27, 2004
6,591
3
81
Looks like there's two ways:

<input type="text" name="foo" autocomplete="off" />

Or have PHP/Javascript whatever randomize the name of the field so that when you ask for address, it ends up being "jkh298y42tyt" which Chrome won't know how to autocomplete. There's no WC3 valid way to do this.
 

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
Jan 2, 2006
10,455
35
91
Looks like there's two ways:

<input type="text" name="foo" autocomplete="off" />

Or have PHP/Javascript whatever randomize the name of the field so that when you ask for address, it ends up being "jkh298y42tyt" which Chrome won't know how to autocomplete. There's no WC3 valid way to do this.

Thanks. I've heard that some browsers don't respect autocomplete="off"?

How exactly does AutoComplete work?

<code><p>Address of Property</p>
<input name="address1" type="text" id="address1" value="" required />
</p></code>

Based on these properties, how does AutoComplete know to put in an predefined address in this field? Is it the "name" or "id"? If I change the name or id to not contain the word "address" would that fix it?
 

Train

Lifer
Jun 22, 2000
13,581
80
91
www.bing.com
Every browser does it a little different, it's probably an and/or of both name and ID, maybe it even uses the closest label as a hint.
 

RampantAndroid

Diamond Member
Jun 27, 2004
6,591
3
81
Every browser does it a little different, it's probably an and/or of both name and ID, maybe it even uses the closest label as a hint.

Yeah, it's the reason why there's no W3C way of doing it. Chrome does it this way, Firefox the other. Just change the ID and the name in addition to the auto complete flag.
 

Train

Lifer
Jun 22, 2000
13,581
80
91
www.bing.com
My clients are Realtors. I provide photography for them. I have them fill out an order submission form in which I ask for the address of the house that they want us to photograph.

Unfortunately, they're not the most detail-oriented bunch of people. Most of the time they put in their name, their browser auto-fills the fields with the address of their OFFICE or their own PERSONAL HOME, NOT the address of the house they're selling, and they press submit without a second thought.

Even after 3 confirmation emails in which the erroneous address is clearly visible, we don't find out that it is the address to their office or personal home until our photographers are already AT the location.

How do I disable auto-complete on my form? It needs to be disabled for any browser they may be using.

Make the entry form a multi-step process, they enter the address... then on the next page you show Google Street view on one side, the birds eye view in the other, with a Giant
"IS THIS THE CORRECT ADDRESS? YES | NO"
 
Last edited: