Class: Formulary::HtmlForm::Fields::CheckboxGroup

Inherits:
FieldGroup show all
Defined in:
lib/formulary/html_form/fields/checkbox_group.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FieldGroup

compatible_with?, #error, #name, #valid?

Methods inherited from Field

#error, #label, #name, #valid?

Constructor Details

#initialize(html_form, group_name, elements) ⇒ CheckboxGroup

Returns a new instance of CheckboxGroup.



11
12
13
14
# File 'lib/formulary/html_form/fields/checkbox_group.rb', line 11

def initialize(html_form, group_name, elements)
  super
  @values = []
end

Class Method Details

.compatible_typeObject



3
4
5
# File 'lib/formulary/html_form/fields/checkbox_group.rb', line 3

def self.compatible_type
  "checkbox"
end

.supports_required?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/formulary/html_form/fields/checkbox_group.rb', line 7

def self.supports_required?
  true
end

Instance Method Details

#set_value(value) ⇒ Object



16
17
18
# File 'lib/formulary/html_form/fields/checkbox_group.rb', line 16

def set_value(value)
  @values = [value].flatten
end