Class: Formulary::HtmlForm::Fields::FieldGroup
- Inherits:
-
Field
- Object
- Field
- Formulary::HtmlForm::Fields::FieldGroup
show all
- Defined in:
- lib/formulary/html_form/fields/field_group.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Field
#get_value_from_data_field, #is_hidden?, #label, #set_value, supports_required?
Constructor Details
#initialize(html_form, group_name, elements) ⇒ FieldGroup
Returns a new instance of FieldGroup.
9
10
11
|
# File 'lib/formulary/html_form/fields/field_group.rb', line 9
def initialize(html_form, group_name, elements)
@html_form, @group_name, @elements = html_form, group_name, elements
end
|
Class Method Details
.compatible_with?(elements) ⇒ Boolean
3
4
5
6
7
|
# File 'lib/formulary/html_form/fields/field_group.rb', line 3
def self.compatible_with?(elements)
elements.all? do |e|
e.name == "input" && e.attributes["type"].value == compatible_type
end
end
|
Instance Method Details
#error ⇒ Object
21
22
23
24
|
# File 'lib/formulary/html_form/fields/field_group.rb', line 21
def error
return super if super.present?
return "'#{label}' must be chosen from the available options" if !value_in_list?
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/formulary/html_form/fields/field_group.rb', line 13
def name
@group_name
end
|
#valid? ⇒ Boolean
17
18
19
|
# File 'lib/formulary/html_form/fields/field_group.rb', line 17
def valid?
super && value_in_list?
end
|