1

I am having simple HTML code:

<form action="login_validation.php">
    <input type="text" name="username1" placeholder="Username" value="">
    <input type="password" name="upassword" placeholder="Password" value="">
</form>

My output is:

enter image description here

But, I am confused, why this has happened (auto-filled username and password) even I have assigned the value="" (assigned blank value) in HTML.

Why blank value is not consider in HTML?

Kurenai Kunai
  • 1,786
  • 2
  • 10
  • 22
Sachink
  • 1,295
  • 9
  • 19
  • Your code is fine. This is probably the browser. You can add autocomplete="off" to your form tag and it will do the trick. – Kurenai Kunai May 11 '15 at 09:44
  • @kurenaiKunai yes, I agree `autocomplete="off"` is work, but why browser not understand the the value initially blank. and browser set any random user name and password on page load which I have used before without user trigger. – Sachink May 11 '15 at 09:54
  • The browsers have auto form fill features which you can turn off and also clear cache to prevent this from happening. – Kurenai Kunai May 11 '15 at 10:13
  • http://stackoverflow.com/questions/15738259/disabling-chrome-autofill – Kurenai Kunai May 11 '15 at 10:15

3 Answers3

1

Your field are yellow. This means that the auto-complete feature of your browser kicked in and filled your fields for you.

Hence, your HTML is fine.

Jean
  • 2,117
  • 2
  • 20
  • 30
1

This will help:

<form action="login_validation.php" autocomplete="off">
    <input type="text" name="username1" placeholder="Username" value="">
    <input type="password" name="upassword" placeholder="Password" value="">
</form>
Zheka
  • 32
  • 4
  • Bradley Gizzi, adding autocomplete parameter to input boxes, as u said, is not a good practice :/ – Zheka May 11 '15 at 09:53
0

You can disable this by adding the attribute autocomplete="off" to the input boxes, though this isn't acknowledged by all browsers

EDIT: Zheka you pretty much just copied my answer.

Exitium
  • 21
  • 5