我正在尝试使用我的注册表格中的autocomplete =“ false”来删除自动填充字段(用户名和密码),但是它不起作用。
我从此网站https://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/spring-form.tld.html#spring-form.tld.input读取了属性自动完成功能
这是我的代码和UI快照。
[![<form:form method="POST" action="${contextPath}/register" modelAttribute="registerForm"
class="form-signin" >
<input autocomplete="false" name="hidden" type="text" style="display:none;">
<spring:bind path="username">
<label class="label">Username</label>
<div class="form-group ${status.error ? 'has-error' : ''}">
<form:input type="text" path="username" class="form-control"
autofocus="true" autocomplete="false" />
<form:errors path="username" cssStyle="color:#ff0000;"></form:errors>
</div>
</spring:bind>
<spring:bind path="email">
<label class="label">Email</label>
<div class="form-group ${status.error ? 'has-error' : ''}">
<form:input id="email" type="email" autocomplete="1" path="email"
class="form-control" name="email"
pattern="\[a-z0-9._%+-\]+@\[a-z0-9.-\]+\.\[a-z\]{2,3}$"/>
<form:errors path="email" cssStyle="color: #ff0000;"></form:errors>
</div>
</spring:bind>
<spring:bind path="password">
<label class="label">Password</label>
<div class="form-group ${status.error ? 'has-error' : ''}">
<form:input type="password" path="password" class="form-control" autocomplete="false" id="password"></form:input>
<form:errors path="password" cssStyle="color: #ff0000;"></form:errors>
</div>
</spring:bind>
<button class="btn btn-primary auth-btn" type="submit">Submit</button>
</form:form>][1]][1]
答案 0 :(得分:0)
您可以使用autocomplete="off"
应该可以解决您的问题