Class: Formulary::HtmlForm::Fields::Select
- Inherits:
-
Field
- Object
- Field
- Formulary::HtmlForm::Fields::Select
show all
- Defined in:
- lib/formulary/html_form/fields/select.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Field
#get_value_from_data_field, #initialize, #is_hidden?, #label, #name, #set_value, supports_required?
Class Method Details
.compatible_with?(element) ⇒ Boolean
3
4
5
|
# File 'lib/formulary/html_form/fields/select.rb', line 3
def self.compatible_with?(element)
element.name == "select"
end
|
Instance Method Details
#error ⇒ Object
11
12
13
|
# File 'lib/formulary/html_form/fields/select.rb', line 11
def error
return "'#{label}' must be chosen from the available options" unless valid?
end
|
#valid? ⇒ Boolean
7
8
9
|
# File 'lib/formulary/html_form/fields/select.rb', line 7
def valid?
valid_values.include?(@value)
end
|