I'm trying to figure out, if it possible to send multiple parameters with radio button.
First parameter will be time
and second provider_id
. I'm using each method for providers, and trying to have option to select only one time and only from one provider.
My view form_tag
:
<%= form_tag(provider_order_create_path) %>
<div class="btn-group" data-toggle="buttons">
<% @group.provider.each do |provider| %>
<label class="btn btn-default">
<%= radio_button_tag :order, time_for_order_00_00.to_datetime, 'false',
{:provider_id => provider.id} %><%= time_tag(time_00_00, :format => '%I:%M %p') %>
</label>
<% end %>
</div>
<%= submit_tag "Submit", type: 'submit', :name => nil %>
At this time i'm seeing only :order params in the logs :provider_id
"order"=>"2016-03-09T00:00:00+00:00"
I tried to use hidden_field
but it not working as expected it is always sending id for last provider in the list
Thank you, any help appreciated
Send an array from the rado button tag, and fetch using the index value in the controller.
In the controller,
I was able to figure it out with help of @Sravan.
and