Class: Kiss::Form::RadioField

Inherits:
MultiChoiceField show all
Defined in:
lib/kiss/form/field.rb

Direct Known Subclasses

BooleanField

Constant Summary

Constants inherited from Field

Field::CURRENCY_SYMBOLS

Instance Method Summary collapse

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



616
617
618
# File 'lib/kiss/form/field.rb', line 616

def element_html(attrs = {})
  column_layout(elements_html(attrs)) + other_field_html + tip_html(attrs)
end

#elements_html(attrs = {}) ⇒ Object



620
621
622
623
624
625
626
627
628
# File 'lib/kiss/form/field.rb', line 620

def elements_html(attrs = {})
  option_pairs.map do |option_value, option_display|
    option_value_string = value_to_s(option_value)
    input_tag_html(
      attrs.merge( :type => 'radio', :value => option_value_string ),
      (value_string == option_value_string) ? 'checked' : ''
    ) + @_currency.to_s + display_to_s(option_display)
  end
end