0

When Google chrome auto-fills the password field with saved credentials info and that I submit the form, the data for the password is an empty string.

Because of this I get a "field is required" kind of error, even thought there is something in the field.

enter image description here

I am using django-allauth but I did some test and the issue seems to also happen when I use basic django Forms.

Any idea what could cause the issue? Ultimately, I could just try to deactivate the auto-populate for this field but I'd rather not.

Note that it behaves properly on firefox, which doesn't populate the field on page load but only when the user select his username in an autocomplete dropdown menu.

EDIT - More info: I found that that this is linked to my form being inside an iframe. When I display it directly on the main page, this issue doesn't happen. I still need to make it work within an iframe though...

EDIT2: After doing some research, it seems to be a bug with chrome not sending the proper events on an iframe that is added dynamically:

https://bugs.chromium.org/p/chromium/issues/detail?id=669045

https://codereview.chromium.org/2603623002

I'm trying to find a work-around....

Ryan Pergent
  • 4,432
  • 3
  • 36
  • 78

1 Answers1

0

use javascript on load page to set value of input = innerhtml.

for example goto facebook.com and open console and write:

document.getElementsByTagName('input')[1].value


you will need to set email input value to

document.getElementsByTagName('input')[1].value
  • Could you be a bit more precise? innerhtml of what? – Ryan Pergent Feb 11 '17 at 21:28
  • for example go to facebook.com and open console and write: document.getElementsByTagName('input')[1].value –  Feb 11 '17 at 21:39
  • you will need to make value of email input = document.getElementsByTagName('input')[1].value –  Feb 11 '17 at 21:39
  • I just tried it, but the innerHtml is also an empty string. (NB: its value is also an empty string) – Ryan Pergent Feb 12 '17 at 10:00
  • I edited my question. I found out that this happens only when my form is in an iframe. Not when it is on the main page. I still need it to work in an iframe however... – Ryan Pergent Feb 12 '17 at 10:07