[英]How to prevent firefox from autofilling username input with e-mail?
I'm using React.我正在使用反应。 I have a registration form component with Username , E-mail and Password fields on it.我有一个注册表组件,上面有用户名、电子邮件和密码字段。 I've set autoComplete="off"
for the entire form, but firefox still trying to autocomplete the form.我已经为整个表单设置autoComplete="off"
,但 Firefox 仍在尝试自动完成表单。 I think this second autocomplete feature is somehow built in browser itself, so i don't think it will be possible to disable it completely from my code.我认为这第二个自动完成功能以某种方式内置于浏览器本身,所以我认为不可能从我的代码中完全禁用它。
I've accepted this, but there is another issue.我已经接受了,但还有另一个问题。 Firefox is trying to fill Username field on the form with E-mail. Firefox 正在尝试使用电子邮件填写表单上的用户名字段。 When i delete Username field autofill switches to E-mail field and works fine, but i dont want to delete Username field.当我删除用户名字段时,自动填充切换到电子邮件字段并且工作正常,但我不想删除用户名字段。 Also, if i rename Username field (both 'name' and 'label' props) to something completely different from 'Username' it works too.此外,如果我将用户名字段(“名称”和“标签”道具)重命名为与“用户名”完全不同的名称,它也可以工作。
Question: how can i prevent Firefox from filling the wrong field?问题:如何防止 Firefox 填写错误的字段?
Here's E-mail and Username components:这是电子邮件和用户名组件:
<FormRow>
<InputText name="username" label="Username" rules={{ required: true }} />
</FormRow>
<FormRow>
<InputText name="email" label="E-mail" rules={{ required: true }} />
</FormRow>
Props name
goes to input
element.道具name
转到input
元素。 Props label
renders in label
element.道具label
呈现在label
元素中。
Thank you!谢谢!
You can try to turn autocomplete off.您可以尝试关闭自动完成功能。 https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.