Module: SimpleForm::Components::HTML5

Included in:
Inputs::Base
Defined in:
lib/simple_form/components/html5.rb

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) has_required?



21
22
23
24
25
26
# File 'lib/simple_form/components/html5.rb', line 21

def has_required?
  # We need to check browser_validations because
  # some browsers are still checking required even
  # if novalidate was given.
  required_field? && SimpleForm.browser_validations
end

- (Object) html5(wrapper_options = nil)



8
9
10
11
12
13
14
15
# File 'lib/simple_form/components/html5.rb', line 8

def html5(wrapper_options = nil)
  @html5 = true
  if has_required?
    input_html_options[:required] = true
    input_html_options[:aria-required'] = true
  end
  nil
end

- (Boolean) html5?



17
18
19
# File 'lib/simple_form/components/html5.rb', line 17

def html5?
  @html5
end

- (Object) initialize



4
5
6
# File 'lib/simple_form/components/html5.rb', line 4

def initialize(*)
  @html5 = false
end