Reputation: 5980
Like in title - I've got a tag (no model) based form (form_tag) and I want after submit obtain values entered in fields of that form - how can I do it?
Upvotes: 0
Views: 114
Reputation: 547
When a form is submitted, such as the one below:
<% form_tag do %>
<label for="first_name">First Name:</label>
<%= text_field_tag :first_name %>
<% end %>
a params
hash is set so you can easily access its values in your controller, like so:
value = params[:first_name]
Upvotes: 1
Reputation: 3957
Just use the params hash in the controller, like so:
def update
field_value = params[:field_name_here]
end
Upvotes: 0