I fetched couple posts over here but I am still unable to make it work. When "Other" radio button is checked I would like a f.text_field to show up and when is unchecked to be hidden. I would like after that to be able to input a text value for thr attribute f.client_consent_refusal_reason.
Here is my HTML:
<table>
<tr>
<td>
<%= form_for(@client, :url => {:controller => 'client', :action=> :outcome_consent_complete, :id => @client.id }) do |f| %>
<%= f.radio_button :client_consent_refusal_reason, 'Hearing loss', :checked => false %>
<%= f.label :radio_button_label, 'aaa' %>
<br>
<%= f.radio_button :client_consent_refusal_reason, 'bbb', :checked => false %>
<%= f.label :radio_button_label, 'ccc' %>
<br>
<%= f.radio_button :client_consent_refusal_reason, 'ddd', :checked => false %>
<%= f.label :radio_button_label, 'eee' %>
<br>
<%= f.radio_button :client_consent_refusal_reason, 'fff', :checked => false %>
<%= f.label :radio_button_label, 'ggg' %>
<br>
<%= f.radio_button :client_consent_refusal_reason, 'Other', :checked => false %>
<%= f.label :radio_button_label, 'Other' %>
<%= f.text_field :client_consent_refusal_reason %>
<br><br>
<div class="actions">
<%= f.submit 'Submit' %>
</div>
<% end %>
</td>
</tr>
</table>
When any of the above radio buttons are checked the field client_consent_refusal_reason should be set to the associated value, but when Other is checked, I would like to be able to capture the correspondent value.
I don't know how to solve this problem.