i am using ruby on rails and have a search form like:
<%= form_tag '/findBlood' do %>
Blood Group <%= text_field_tag "bloodGroup" %>
<%= submit_tag "Search", class: "btn btn-large btn-primary"%>
<% end %>
This works as expected however, on submit the bloodGroup field clears and as a result probably pagination breaks. how to retain this field?
This should do the trick for you
See docs for text_field_tag
The reason a symbol works and the string (other answer) doesn’t work:
You can easily convert between strings and symbols in Ruby, but they are not equal.