Reputation: 468
I need to send some parameters to controller on form submitting. With anchor there's no problem, but in form I dont get parameters in controller.
= form_tag objects_path("Sample" => "Test", :return_param => @param_value), :method => :get do
= submit_tag 'Submit', :id=>'objects_submit'
link_to 'Link Title', objects_path("Sample" => "Test", :return_param => @param_value)
Upvotes: 3
Views: 197
Reputation: 211610
You might want to include it as part of the form submission instead as mixing GET and POST parameters can lead to confusion.
Add this inside the form_tag
block:
= hidden_field_tag("Sample", "Test")
= hidden_field_tag(:return_param, @param_value)
You can always see what parameters are being received by your controller by watching log/development.log
.
Upvotes: 2