Class: HungryForm::Elements::SelectField
- Inherits:
-
Base::OptionsElement
- Object
- Base::Element
- Base::ActiveElement
- Base::OptionsElement
- HungryForm::Elements::SelectField
- Defined in:
- lib/hungryform/elements/select_field.rb
Instance Attribute Summary
Attributes inherited from Base::OptionsElement
Attributes inherited from Base::ActiveElement
Attributes inherited from Base::Element
#attributes, #dependency, #label, #name, #placeholders, #resolver, #visible
Instance Method Summary collapse
-
#set_value ⇒ Object
Sets a value of the element Checks the value from the resolver params against the available options.
Methods inherited from Base::OptionsElement
Methods inherited from Base::ActiveElement
#clear_error, #initialize, #invalid?, #valid?, #validate_rule
Methods inherited from Base::Element
#configuration, #dependency_json, #initialize
Methods included from Base::Hashable
Constructor Details
This class inherits a constructor from HungryForm::Elements::Base::OptionsElement
Instance Method Details
#set_value ⇒ Object
Sets a value of the element Checks the value from the resolver params against the available options
6 7 8 9 10 11 12 |
# File 'lib/hungryform/elements/select_field.rb', line 6 def set_value if resolver.params.key?(name) self.value = resolver.params[name] if acceptable_values? else self.value = attributes.delete(:value) end end |