Class: RadioGroup
- Inherits:
-
Group
- Object
- BasicField
- Group
- RadioGroup
- Defined in:
- lib/formalize/field.rb
Instance Method Summary collapse
Methods inherited from Group
Methods inherited from BasicField
#errors, #errors=, #initialize, #input, #valid?, #validate, #validate_format, #validate_length, #validate_presence, #value
Methods included from Helpers
#tag, #tag_attributes, #tag_content
Constructor Details
This class inherits a constructor from Group
Instance Method Details
#choice(value, choice_opts = {}) ⇒ Object
140 141 142 143 |
# File 'lib/formalize/field.rb', line 140 def choice(value, choice_opts={}) choice_opts[:value] = value @choices.push(RadioField.new(@opts[:name], choice_opts)) end |
#value=(val) ⇒ Object
144 145 146 147 |
# File 'lib/formalize/field.rb', line 144 def value=(val) @opts[:value] = val @choices.each { |choice| choice.opts[:checked] = (choice.opts[:value] === val.to_sym) } end |