Connect with Expertise | Find Experts, Get Answers, Share Insights

Browsers auto-filling bad fields

 
Join Date: Jan 2010
Posts: 7
#1: Jan 12 '10
Hello,

All the browsers I tested are filling two fields that aren't for logging in, both have different names from the ones on the login form, and eventhough, the browsers fill them, I have read that removing the value tag instead of just writing empty would resolve the problem, but the value tag is already absent from my fields.

PS : Just to mention that my fields have text and password as types.

How can I avoid that ? Does anyone know ?

✓ answered by gits

here is a nice article which handles the autocomplete-issue ... to avoid it you might use the attribute:
Expand|Select|Wrap|Line Numbers
  1. autocomplete="off"
for a node ... but since it is non-standard it will invalidate the html. one workaround would be to set it through javascript ...

kind regards

acoder's Avatar
E
M
C
 
Join Date: Nov 2006
Location: UK
Posts: 14,979
#2: Jan 13 '10

re: Browsers auto-filling bad fields


Most likely the cause will be the password field. Is there any need to have another password field? A link or some code?
 
Join Date: Jan 2010
Posts: 7
#3: Jan 13 '10

re: Browsers auto-filling bad fields


I have another password field just after this one, for confirmation.
acoder's Avatar
E
M
C
 
Join Date: Nov 2006
Location: UK
Posts: 14,979
#4: Jan 13 '10

re: Browsers auto-filling bad fields


Can you post the HTML code or a link?
 
Join Date: Jan 2010
Posts: 7
#5: Jan 13 '10

re: Browsers auto-filling bad fields


Expand|Select|Wrap|Line Numbers
  1.     <tr>
  2.             <td class="odd">Website</td>
  3.             <td class="odd">
  4.             <input type="text" <?php if(!empty($user['url'])) echo "value=\"{$user['url']}\"";?> name="url" />
  5.             </td>
  6.         </tr>
  7.         <tr>
  8.         <td class="odd">New password</td>
  9.         <td>
  10.         <input type="password" name="newpass" id="newpass" />
  11.         <input type="password" name="newpassconfirm" id="newpassconfirm" />
  12.         </td>
  13.         </tr>
  14.  
here is the code, newpass gets the password and the url fields gets the uname, I noticed that when the database returns a non-empty value, it doesn't happen.
acoder's Avatar
E
M
C
 
Join Date: Nov 2006
Location: UK
Posts: 14,979
#6: Jan 15 '10

re: Browsers auto-filling bad fields


Is the login form on the same page? If not, the problem will be that the browsers see a blank text field followed by a password field and think "login form" and fill the fields.
 
Join Date: Jan 2010
Posts: 7
#7: Jan 15 '10

re: Browsers auto-filling bad fields


The login form will never be in this page, as it is an area for logged-in users only, I will by default fill the field with "http://" if db is empty .. thanks acoder for your messages
gits's Avatar
E
M
C
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,702
#8: Jan 15 '10

re: Browsers auto-filling bad fields


here is a nice article which handles the autocomplete-issue ... to avoid it you might use the attribute:
Expand|Select|Wrap|Line Numbers
  1. autocomplete="off"
for a node ... but since it is non-standard it will invalidate the html. one workaround would be to set it through javascript ...

kind regards
 
Join Date: Jan 2010
Posts: 7
#9: Jan 15 '10

re: Browsers auto-filling bad fields


Thanks a lot it worked !
Reply

Tags
fields, filling, form, login, password