如何在Form_tag帮助器中使用帮助器?

时间:2013-10-23 17:40:45

标签: ruby-on-rails ruby-on-rails-3 form-helpers

我写了这段代码:

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

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

我面临的问题是提交标签正在替换text_field标签,即只显示提交标签,我希望它们都出现。代码有什么问题?

此致

1 个答案:

答案 0 :(得分:0)

试试这个:

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