Browsers auto-filling bad fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • logicbloke
    New Member
    • Jan 2010
    • 7

    Browsers auto-filling bad fields

    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 ?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Most likely the cause will be the password field. Is there any need to have another password field? A link or some code?

    Comment

    • logicbloke
      New Member
      • Jan 2010
      • 7

      #3
      I have another password field just after this one, for confirmation.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Can you post the HTML code or a link?

        Comment

        • logicbloke
          New Member
          • Jan 2010
          • 7

          #5
          Code:
          	<tr>
          			<td class="odd">Website</td>
          			<td class="odd">
          			<input type="text" <?php if(!empty($user['url'])) echo "value=\"{$user['url']}\"";?> name="url" />
          			</td>
          		</tr>
          		<tr>
          		<td class="odd">New password</td>
          		<td>
          		<input type="password" name="newpass" id="newpass" />
          		<input type="password" name="newpassconfirm" id="newpassconfirm" />
          		</td>
          		</tr>
          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.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            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.

            Comment

            • logicbloke
              New Member
              • Jan 2010
              • 7

              #7
              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

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                here is a nice article which handles the autocomplete-issue ... to avoid it you might use the attribute:
                Code:
                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

                Comment

                • logicbloke
                  New Member
                  • Jan 2010
                  • 7

                  #9
                  Thanks a lot it worked !

                  Comment

                  Working...