Class: Kiss::Form::MultiSelectField
- Inherits:
-
MultiValueField
- Object
- Field
- MultiChoiceField
- MultiValueField
- Kiss::Form::MultiSelectField
- Defined in:
- lib/kiss/form/field.rb
Constant Summary
Constants inherited from Field
Instance Method Summary collapse
Methods inherited from MultiValueField
#param, #selected_option_values, #validate
Methods inherited from MultiChoiceField
#column_layout, #display_to_s, #form=, #has_option_value?, #initialize, #option_pairs, #options_keys, #other_field_html, #validate
Methods inherited from Field
#add_error, #content_tag_html, #debug, #errors_html, #html, #initialize, #input_tag_html, #method_missing, #param, #require_value, #reset, #set_value_to_hash, #set_value_to_object, #tag_html, #tag_start_html, #tip_html, #type, #validate, #value, #value_string, #value_to_s
Constructor Details
This class inherits a constructor from Kiss::Form::MultiChoiceField
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Kiss::Form::Field
Instance Method Details
#element_html(attrs = {}) ⇒ Object
663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
# File 'lib/kiss/form/field.rb', line 663 def element_html(attrs = {}) = option_pairs.map do |option_value, option_display| option_value_string = value_to_s(option_value) selected = selected_option_values[option_value_string] ? ' selected' : '' %Q(<option value="#{option_value_string}"#{selected}>#{display_to_s(option_display)}</option>) end.join content_tag_html( 'select', , attrs, 'multiple' ) end |