Class: REDCap::Form::CheckboxesWithRadioButtonsOrOther

Inherits:
CheckboxesWithOther show all
Defined in:
lib/red_cap/form/fields.rb

Constant Summary

Constants inherited from Field

Field::KEYS

Instance Attribute Summary

Attributes inherited from Field

#associated_fields, #attributes, #options

Instance Method Summary collapse

Methods inherited from CheckboxesWithOther

#other?, #other_text_field

Methods inherited from RadioButtons

#options

Methods inherited from Field

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class REDCap::Form::Field

Instance Method Details

#value(responses) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/red_cap/form/fields.rb', line 138

def value responses
  radio_or_other_values = selected_options(responses).keys.map do |key|
    if other?(key)
      other_text_field(key)&.value(responses)
    else
      radio_field_for(key)&.value(responses)
    end
  end

  Hash[selected_options(responses).values.zip(radio_or_other_values)]
end