开发者

handing over a param from a rails form tag

开发者 https://www.devze.com 2023-01-06 22:43 出处:网络
I\'m using a form tag to implement a search text_field. <% form_tag catalogues_path(:select => params[:select]), :method => \"get\" do %>

I'm using a form tag to implement a search text_field.

<% form_tag catalogues_path(:select => params[:select]), :method => "get" do %>

The problem is the catalogues_path which should consist the select param. Unfortunately the select param doesn't get handed over in the upper example...

The result is the same as if I would just write:

<% form_tag catalogues_path, :method => "get" do %>

Any hint will be ap开发者_运维百科preciated!

Thanks Makrus


Hi If you want to sent something from your form as params[:select] use hidden_field_tag :select, :value=>params[:select] inside your form or do you want to have something like

http://localhost/catalogues?select=something in your url ?


it work's for me .

why don't you write html directly then

<form method="get" action="/catalogues?select=<%= params[:select] %>">

</form>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号