1

I have a rather irritating issue with Chrome autofill on a dropdownlist. The dropdownlist selects a county to add a permit charge. When you autofill an address it selects the autofilled county name in the dropdownlist which then, in turn, adds a permit charge. I've tried amending the dropdownlist id from selCounty which didn't work.

Depending on the circumstances, a permit charge may not be required, so I can see that customers may inadvertently select this without realising when autofilling.

I've looked at similar SO questions relating to username/password issues and I've tried using a hidden dropdown for it to select instead as a wild stab in the dark without luck.

Here's the dropdownlist code:

<select id="fakeSelCty" style="display:none"></select>         
@Html.DropDownListFor(
    x => x.SelectedPermitCountyId,
    new SelectList(Model.PermitCounties, "PermitCountyId", "PermitCounty"),
    new { @class = "form-control  input-sm", id = "selCty" })

Any suggestions as autocomplete="off" doesn't work in Chrome?

ComfortablyNumb
  • 1,408
  • 8
  • 34
  • 64

1 Answers1

0

Fixed it!

I used this solution @readonly = "readonly", onfocus = "this.removeAttribute('readonly');""

Taken from the third answer here. I modified the CSS to change the readonly appearance so it would not confuse the user.

Community
  • 1
  • 1
ComfortablyNumb
  • 1,408
  • 8
  • 34
  • 64