class Formulary::HtmlForm::Fields::FieldGroup

Public Class Methods

compatible_with?(elements) click to toggle source
# 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
new(html_form, group_name, elements) click to toggle source
# 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

Public Instance Methods

error() click to toggle source
# 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() click to toggle source
# File lib/formulary/html_form/fields/field_group.rb, line 13
def name
  @group_name
end
valid?() click to toggle source
# File lib/formulary/html_form/fields/field_group.rb, line 17
def valid?
  super && value_in_list?
end