html/thymeleaf - 如何防止输入字段被检测为信用卡相关字段?
html/thymeleaf - How to prevent input field detected as credit card related fields?
Chrome 将一些输入字段检测为信用卡字段。我如何在 HTML?
中避免它
似乎 Chrome 会在字段名称等上使用一些正则表达式来检测此类字段(参见:here)。
目前对我来说唯一已知的解决方案是重命名该字段。
我试过使用 autocomplete="off"
和 autocomplete="new-password"
.
是否有任何 HTML 属性或技巧可以避免这种情况?
截图:
输入字段的 Thymeleaf 代码:
<td class="report-form-td2">
<input class="calendar2 input-s" type="text"
placeholder="dd-mm-yyyy"
th:field="*{dateStr}"
maxlength="10" autocomplete="off"/>
</td>
转换为 HTML:
<td class="report-form-td2">
<input class="calendar2 input-s" type="text"
placeholder="dd-mm-yyyy"
id="dateStr" name="dateStr"
maxlength="10" autocomplete="off"/>
</td>
谢谢。
显然,此行为是由于使用了 placeholder='dd-mm-yyyy'
。 Google 会将其检测为 CC 字段。
临时解决方法:
删除占位符。
额外提示:
因此,在这种情况下更改输入 id/name 属性将无济于事。
但如果该字段正在使用 id/name,如 mercId, mercName
,重命名它们会有所帮助。
Chrome 将一些输入字段检测为信用卡字段。我如何在 HTML?
中避免它似乎 Chrome 会在字段名称等上使用一些正则表达式来检测此类字段(参见:here)。
目前对我来说唯一已知的解决方案是重命名该字段。
我试过使用 autocomplete="off"
和 autocomplete="new-password"
.
是否有任何 HTML 属性或技巧可以避免这种情况?
截图:
输入字段的 Thymeleaf 代码:
<td class="report-form-td2">
<input class="calendar2 input-s" type="text"
placeholder="dd-mm-yyyy"
th:field="*{dateStr}"
maxlength="10" autocomplete="off"/>
</td>
转换为 HTML:
<td class="report-form-td2">
<input class="calendar2 input-s" type="text"
placeholder="dd-mm-yyyy"
id="dateStr" name="dateStr"
maxlength="10" autocomplete="off"/>
</td>
谢谢。
显然,此行为是由于使用了 placeholder='dd-mm-yyyy'
。 Google 会将其检测为 CC 字段。
临时解决方法:
删除占位符。
额外提示:
因此,在这种情况下更改输入 id/name 属性将无济于事。
但如果该字段正在使用 id/name,如 mercId, mercName
,重命名它们会有所帮助。