-
Notifications
You must be signed in to change notification settings - Fork 1.3k
HTML5 Attributes
HTML5 brings dozen of new input types (such as number, email, etc.) and attributes (such as required, min, max, step, etc.). SimpleForm would automatically add these attributes where appropriate.
Some of these types would trigger client side validation. If you have problems with client side validation (because of browser inconsistent behavior or issues with javascript code that hide required fields) you can turn off client validation with ‘novalidate’ attribute on form:
<%= simple_form_for(resource, html: {novalidate: true}) do |form| %>
Often and not very descriptive error in webkit browsers that prevents invalid form to be submitted is: An invalid form control with name FIELDNAME is not focusable.
A further explanation of the required attributes behavior on HTML5 compatible browsers can be read in Dive Into HTML5 . If you experience unexpected errors doing integration testing, as the one described in this conversation, make sure you either deactivate html5 validations, or fill in all the required fields.
This page was created by the OSS community and might be outdated or incomplete. Feel free to improve or update this content according to the latest versions of SimpleForm and Rails to help the next developer who visits this wiki after you.
Keep in mind to maintain the guides as simple as possible and to avoid additional dependencies that might be specific to your application or workflow (such as Haml, RSpec, Guard and similars).