0

Inside a <form> I want to use multiple Password type fields but.. I want to make some of them not to be remembering the value of it.

Normally i can use autocomplete=off inside <form> tag. But this affects over every single fields inside.

Edited: Got Simple Solution Now
<input autocomplete="off" ....... />

夏期劇場
  • 17,821
  • 44
  • 135
  • 217

3 Answers3

1

You can set autocomplete on a single field by using:

@Html.TextBoxFor(x => x.Property, new {autocomplete = "off"})

If you're using DisplayForModel than you will have to create a custom Edit Template.

Jakub Konecki
  • 45,581
  • 7
  • 87
  • 126
1

Yes, you can (set autocomplete="off" on individual inputs).

simshaun
  • 21,263
  • 1
  • 57
  • 73
1

You can set it on individual fields, but it's a non-standard HTMl extension and will cause your pages to fail validation: Is there a W3C valid way to disable autocomplete in a HTML form?

Community
  • 1
  • 1
Marc B
  • 356,200
  • 43
  • 426
  • 500