Improve HTML 5 readme

This commit is contained in:
Carlos Antonio da Silva 2011-05-16 07:18:17 -03:00
parent aab1976213
commit 136cb9ac7b
2 changed files with 10 additions and 12 deletions

View File

@ -390,23 +390,21 @@ There are other options that can be configured through I18n API, such as require
== HTML 5 Notice
By default, simple_form will generate input field types and attributes that are supported in HTML5, but are considered
invalid HTML for older document types HTML4 or XHTML1.0. The HTML5 extensions include the new field types such as email, number, search, url,
tel, and the new attributes such as required, autofocus, maxlength, min, max, step.
By default, SimpleForm will generate input field types and attributes that are supported in HTML5, but are considered invalid HTML for older document types such as HTML4 or XHTML1.0. The HTML5 extensions include the new field types such as email, number, search, url, tel, and the new attributes such as required, autofocus, maxlength, min, max, step.
Most browsers will not care, but some of the newer ones, in particular Chrome 10, uses the required
attribute to force an input into a field and will prevent form submission without it. Depending on the design of
the site this may or may not be desired. In many cases it can break existing UI's.
Most browsers will not care, but some of the newer ones - in particular Chrome 10+ - use the required attribute to force a value into an input and will prevent form submission without it. Depending on the design of the application this may or may not be desired. In many cases it can break existing UI's.
The following configuration option permits disabling all HTML5 extensions:
It is possible to disable all HTML 5 extensions in SimpleForm with the following configuration:
SimpleForm.use_html5 = false # default is true
SimpleForm.html5 = false # default is true
Or you can use the following configuration to disable only the browser validation:
If you want to have all other HTML 5 features, such as the new field types, you can disable only the browser validation:
SimpleForm.disable_browser_validations = true # default is false
SimpleForm.browser_validations = false # default is true
You can do this in the configuration block, generated in the following section.
This option adds a new `novalidate` property to the form, instructing it to skip all HTML 5 validation. The inputs will still be generated with the required and other attributes, that might help you to use some generic javascript validation.
Please notice that any of the configurations above will disable the `placeholder` component, which is an HTML 5 feature. We believe most of the newest browsers are handling this attribute fine, and if they aren't, any plugin you use would take of using the placeholder attribute to do it. However, you can disable it if you want, by removing the placeholder component from the components list in SimpleForm configuration file.
== Configuration

View File

@ -40,7 +40,7 @@ module MiscHelpers
def custom_mapping_form_for(object, *args, &block)
simple_form_for(object, *(args << { :builder => CustomMapTypeFormBuilder }), &block)
end
def with_concat_custom_mapping_form_for(object, &block)
concat custom_mapping_form_for(object, &block)
end