【发布时间】:2013-10-11 14:39:38
【问题描述】:
我的登录页面(使用简单表单构建)默认添加 html 属性,用于对 chrome 无法识别的电子邮件输入进行浏览器验证并显示“请匹配请求的格式”。
可能是 Chrome 错误(在 firefox 上有效),因此尝试使用简单的表单配置禁用浏览器验证
SimpleForm.html5 和 SimpleForm.browser_validations(默认为 false),重新启动 rails 但保持相同的输入:
<input autofocus="autofocus" class="string email optional form-control
input-xlarge" id="customer_email" maxlength="255"
name="customer[email]" pattern="\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z"
size="255" type="email">
也尝试添加表单html: {novalidate: true},输出相同
终于尝试在input_filed上添加:novalidate => true,html输出变为:
<input autofocus="autofocus" class="string email optional form-control
input-xlarge" id="customer_email" maxlength="255"
name="customer[email]" pattern="\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z"
size="255" type="email" novalidate="novalidate">
但存在浏览器验证和 chrome 错误。
有什么解决办法吗?
PS:使用 Bootstrap,登录表单来自 Devise 资源。
【问题讨论】:
标签: ruby-on-rails html simple-form