Reputation: 3609
my login page( build with simple form) add by default html attributes for browser validation on email input that chrome doesn't recognize and show "Please match the requested format."
Maybe is Chrome bug(on firefox works), so have tried to disable browser validation with simple form config
SimpleForm.html5
and SimpleForm.browser_validations
(false by default), restarted rails but remain the same input:
<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">
have tried also to add on form html: {novalidate: true}
, same output
finally have tried to add on input_filed :novalidate => true
, the html output change to:
<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">
but browser validation and chrome error is present.
Any idea to resolve?
PS: Use Bootstrap and the login form is from Devise resource.
Upvotes: 1
Views: 5008
Reputation: 37729
You can remove the pattern attribute from the input element that is causing a problem. You just need to set pattern: false
on the input field.
So your input field might look something like this:
<%= f.input_field :email, type: 'email', required: true, autofocus: true, class: 'form-control', pattern: false %>
(nil
doesn't work; it has to be false
.)
This worked for me in Rails 4.
Upvotes: 1