I make a loop to show my options and need make a link or buttom to pass the value of my radio buttom to my link or buttom but i dont know how i get this value, please someone can help, my loop whit my journals is:
<div id="add_post">
<h1>Escolha o Jornal que deseja adicionar:</h1>
<ul>
<% current_user.journals.each do |journal| %>
<li><%= radio_button_tag 'journal',journal.id %><%= journal.name %></li>
<%end%>
</ul>
<%= link_to "Adicionar",add_post_complete_journal_path(HEREEE),:remote=>true %>
</div>
Where say HEREEE is where i want appear the options choised, please help me i thanks very very mutch
You can use JS/Jquery to achieve the same. Just give a name to all radio buttons like “myradiobutton”. Then get the value of selected radio button using Jquery and pass it via an AJAX call.
Something like: