如何使Chrome尊重我的字段的名称,而不是尝试自动完成 [英] How to make Chrome respect the names of my fields and not attempt to autocomplete

查看:213
本文介绍了如何使Chrome尊重我的字段的名称,而不是尝试自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主页有两种不同的表单:一种用于登录,一种用于注册。从代码中可以看出,表单具有不同名称的输入:

 < h3>登录< / h3> 
< form action =/ login /method =POSTclass =form-verticalstyle =padding-top:5px>
< input id =id_login_usernametype =textname =login_usernamemaxlength =25/>
< input type =passwordname =login_passwordid =id_login_password/>< br>
< button type =submitclass =btn btn-info>登录< / button>
< / form>

< h3>注册< small>(免费!)< / small>< / h3>
< form action =/ register /method =POSTclass =form-verticalstyle =padding-top:5px>
< input id =id_register_usernametype =textname =register_usernamemaxlength =25/>
< input type =textname =register_emailid =id_register_email/>
< input type =passwordname =register_passwordid =id_register_password/>
< input type =passwordname =register_password2id =id_register_password2/>< br>
< button type =submitclass =btn> Submit< / button>
< / form>

这在Chrome中呈现:





可能导致什么这个?如何解决?

解决方案

似乎有一个类似的问题已经被问过:



什么是停止表单输入框自动完成的正确方法?



有一个自动填充属性可以在表单域中使用。

 < input id =id_login_usernametype =textname =login_usernamemaxlength =25autocomplete = 关/> 


I have two different forms on my home page: one for logins and one for registrations. As you can see from the code, the forms have inputs with different names:

<h3> Log In </h3>
<form action="/login/" method="POST" class="form-vertical" style="padding-top: 5px">
  <input id="id_login_username" type="text" name="login_username" maxlength="25" />
  <input type="password" name="login_password" id="id_login_password" /><br>
  <button type="submit" class="btn btn-info">Login</button>
</form>

<h3> Sign Up <small>(It's free!)</small></h3>
<form action="/register/" method="POST" class="form-vertical" style="padding-top: 5px">
  <input id="id_register_username" type="text" name="register_username" maxlength="25" />
  <input type="text" name="register_email" id="id_register_email" />
  <input type="password" name="register_password" id="id_register_password" />
  <input type="password" name="register_password2" id="id_register_password2" /><br>
  <button type="submit" class="btn">Submit</button>
</form>

Which renders to this in Chrome:

What can be causing this? And how can I fix it?

解决方案

It appears a similar question has been asked before:

What is the correct way to stop form input boxes auto-completing?

There is an autocomplete attribute you can use in form fields.

<input id="id_login_username" type="text" name="login_username" maxlength="25" autocomplete="off" />

这篇关于如何使Chrome尊重我的字段的名称,而不是尝试自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆