Reputation: 997
I am using ROR , For my app user input is needed in view.For this i am using this:
<%= form_tag("/new", method: "get") do %>
<%= label_tag(:q, "Search for:") %>
<%= text_field_tag(:q) %>
<%= submit_tag("Search") %>
<% end %>
My question is,how can i access the text user enter into text field into my controller new action?
Upvotes: 0
Views: 389
Reputation: 831
The element text_field_tag(:q)
should submit a parameter "q", which can then be read on the server by calling params[:q]
.
Upvotes: 3