Forum: Ruby on Rails start_form_tag with method GET

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
74592905ef38cd087e5b73c0955aaa18?d=identicon&s=25 Martin Smith (Guest)
on 2006-02-21 17:35
Hi,

How can I get start_form_tag to use GET instead of POST?

I have tried...

<%= start_form_tag {:action => 'search'}, {:method => 'get'} %>

But it doesn't work...

compile error
./script/../config/../app/views/search/index.rhtml:35: syntax error
_erbout.concat(( start_form_tag {:action => 'search'}, {:method =>
'get'} ).to_s); _erbout.concat "\n"
                                           ^
./script/../config/../app/views/search/index.rhtml:35: syntax error
_erbout.concat(( start_form_tag {:action => 'search'}, {:method =>
'get'} ).to_s); _erbout.concat "\n"
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Joshua Schairbaum (Guest)
on 2006-02-21 19:12
(Received via mailing list)
On Tuesday, February 21, 2006, at 5:35 PM, Martin Smith wrote:
>Hi,
>
>How can I get start_form_tag to use GET instead of POST?
>
>I have tried...
>
><%= start_form_tag {:action => 'search'}, {:method => 'get'} %>
>
Here is how I have done it:

<%= form_tag({:action => 'results'}, :method => 'get') %>

I think perhaps you're just missing the parenthesis.
C4dc94c893471878a105761a9207f29b?d=identicon&s=25 Zack Chandler (Guest)
on 2006-02-21 23:37
(Received via mailing list)
Martin,

You can also use a symbol... here is an extract from some code...

<%= link_to_remote 'edit',
  :url => edit_customer_url(:model_number => @customer.customer_number),
  :method => :get,
  :update => 'edit_' + css_id_for(@customer),
  :success => "Element.toggle('show_#{css_id_for(@customer)}',
'edit_#{css_id_for(@customer)}')",
  :failure => "alert('An error occurred. Please try again.')" %>

Hope this helps,
Zack

On 21 Feb 2006 18:10:11 -0000, Joshua Schairbaum <
This topic is locked and can not be replied to.