Question

I have written this code:

     <%=
        form_tag({:action => "simple_search", :method => 'get'}) do
    text_field_tag(:searchTextField, "Search by first name")

    submit_tag "Search", class: "edit_button"
        end
     %>

The problem I am facing is that submit tag is replacing the text_field tag, i.e. only submit tag appears, i want both of them to appear. What is wrong with code?

Regards

Was it helpful?

Solution

Try this:

<%= form_tag({:action => "simple_search", :method => 'get'}) do %>
  <%= text_field_tag(:searchTextField, "Search by first name") %>
  <%= submit_tag "Search", class: "edit_button" %>
<% end %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top