Class: Kiss::Form::CheckboxField
- Inherits:
-
MultiValueField
- Object
- Field
- MultiChoiceField
- MultiValueField
- Kiss::Form::CheckboxField
- 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
639 640 641 642 643 644 645 646 647 |
# File 'lib/kiss/form/field.rb', line 639 def element_html(attrs = {}) = @_hidden_join ? input_tag_html( :type => 'hidden', :name => "#{@_name}_options", :value => option_pairs.map {|option_value, option_display| value_to_s(option_value) }.join(@_hidden_join) ) : '' column_layout(elements_html(attrs)) + other_field_html + + tip_html(attrs) end |
#elements_html(attrs = {}) ⇒ Object
649 650 651 652 653 654 655 656 657 658 659 |
# File 'lib/kiss/form/field.rb', line 649 def elements_html(attrs = {}) name = @_name + '[]' option_pairs.map do |option_value, option_display| option_value_string = value_to_s(option_value) input_tag_html( attrs.merge( :name => name, :value => option_value_string ), selected_option_values[option_value_string] ? 'checked' : '' ) + @_currency.to_s + display_to_s(option_display) end end |