Answer the question
In order to leave comments, you need to log in
Triggering autocomplete fields on other forms in Chrome and Safari
Hi all! Maybe someone faced such a problem, there are two forms on different pages, on the site, authorization and registration.
Authorization form:
form#login(action="/login", method="post")
input#login_username(type="text", name="login_username", placeholder="Username")
input#login_password(type="password", name="login_username", placeholder="Password")
form#register(action="/sign-up", method="post")
input#sign_up_email(type="email", name="sign_up_email", placeholder="E-mail")
input#sign_up_username(type="text", name="sign_up_username", placeholder="Username")
input#sign_up_password(type="password", name="sign_up_password", placeholder="Password")
Answer the question
In order to leave comments, you need to log in
I stumbled upon your question by accident while looking for an answer.
The solution is simple :)
<form autocomplete="off">
<input name="name" type="text">
<input name="password" type="password" autocomplete="new-password"> // autocomplete="new-password" это решение для хрома
</form>
Found a solution that works. Add a hidden password field to the form.
<input type="password"
autocomplete="off"
name="passwordFake"
style="position:absolute; opacity: 0; filter: alpha(opacity = 0);"/>
somehow it was also necessary to cut off autocomplete for the browser, and all the dances with autocomplete
did not give any result - the browser still diligently filled in the fields with the login and password ;
the option with autocomplete="new-password" seems to work too, although it may not work in all browsers
https://developer.mozilla.org/en-US/docs/Web/Secur...
Where are you autocomplete="off"
? It should be on both the form and the elements.
Change the IDs and names of the fields/form as they are the same for you now. Change the path to the forms too. Change to something unintelligible.
Better yet, don't worry about it.
The problem was solved by simply adding a hidden text field after the required input. If the desired input has a class, add the same class to the hidden input.<input type="text" style="display:none;">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question