Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop browser from filling textboxes with details

I've run into a really annoying problem, and I'm hoping it's just a setting I've missed. I've got an ASP.NET application which allows users to enter their username/password in various places (e.g. login, change password, change username etc..). When I logged in, the browser asked if I would like to store the user details. Usually, I click 'no', but this time I decided to click 'yes'. Now, certain textboxes in my form are prefilled with the username or password. Is it possible to remove these, as they sometimes appear in textboxes which shouldn't be prefilled. I tried setting AutoCompleteType=none and Text='' but it still gets prefilled. The textboxes don't have much in common, except the same CssClass and, for password boxes, TextMode=password. The names are different, although sometimes they include the word name (e.g. fullName, userName). Is there a way to stop the browser from filling certain textboxes?

Thanks

like image 407
keyboardP Avatar asked Apr 13 '10 15:04

keyboardP


3 Answers

The only solution that worked for me was to include two fields, one for login and one for the password with display: none <input type="text" style="display: none"> <input type="password" style="display: none">

like image 21
IndraKiran Reddy S Avatar answered Oct 23 '22 04:10

IndraKiran Reddy S


  <input type="text" name="Username" autocomplete="off">

You can also put this on the form tag. Note this does not work consistently in all browsers.

like image 197
D'Arcy Rittich Avatar answered Oct 23 '22 04:10

D'Arcy Rittich


if you set autocomplete="off"... the textbox will loose every words on its history... but if you want to prevent browser saved usernames and password, the best way is to put these tags in top of your page:

<input type="text" style="display: none"> 
<input type="password" style="display: none">
like image 1
Farhad Avatar answered Oct 23 '22 06:10

Farhad