mercredi 17 février 2016

Rails 4 : Input text box to search without submit button on index page

In my rails application on Customer index page I need a text input box without a submit button next to it. I just want to type customer number inside it and on pressing enter button the search should work. How to implement it ?

            <div class="row">
              <%= form_tag customers_path, :method => 'get', class: 'input-group'  do %>
                <%= text_field_tag :search, params[:search], class: 'form-control', placeholder: 'Search Customers' %>
                <span class="input-group-btn">
                  <%= submit_tag "search", class: "btn btn-success btn-md" %>
                </span>
              <% end %>
            </div>

I have placed it on top of my index page of customers page just above the customer number column, So I don't want this search box plus the button to take a big space in my view. So I don't need the submit button. Or is there any way to replace the search button with a right pointing arrow button(bootstarp) to save space in my view.

Aucun commentaire:

Enregistrer un commentaire