Forum: Ruby on Rails need help for simple form tag (noob)

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.
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2006-05-14 20:24
(Received via mailing list)
when the user click on "Search" I would like it to point to
http://curentpage/?filter=searchtext (the filtering code is already
written)

it would look like this:

<%= start_form_tag(url_for_options = {<something>}) %>
<%=text_field (<my_filter>) %>
<%= submit_tag(value = "Search")%>

any idea how to do this?

thanx in advance
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-05-15 13:17
(Received via mailing list)
Patrick Aljord wrote:
> any idea how to do this?
<%= form_tag({}, :method => 'get') %>
<%= text_field_tag 'filter' %>
<%= submit_tag 'Search' %>
<%= end_form_tag %>

--
We develop, watch us RoR, in numbers too big to ignore.
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2006-05-16 19:45
(Received via mailing list)
On 5/15/06, Mark Reginald James <mrj@bigpond.net.au> wrote:
> > <%= submit_tag(value = "Search")%>
> >
> > any idea how to do this?
>
>
> <%= form_tag({}, :method => 'get') %>
> <%= text_field_tag 'filter' %>
> <%= submit_tag 'Search' %>
> <%= end_form_tag %>
>
> ok thanx a lot, I'm using params[:filter] in my controller and it works
great.
Now I'm trying the post method like this:

<%= form_tag({}, :method => 'get') %>
<label class="required" for="document_filter">test autocomplete</label>
<%= text_field_with_auto_complete :stage, :sujet %>
<%= submit_tag 'Search' %>
<%= end_form_tag %><p>

the autocomplete part works great but how can I get the posted value? I
get
a url like '?object%5Bmethod%5D=textvalue'

thanx in advance

Pat
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2006-05-17 01:45
(Received via mailing list)
Patrick Aljord wrote:

> Now I'm trying the post method like this:
>
> <%= form_tag({}, :method => 'get') %>
> <label class="required" for="document_filter">test autocomplete</label>
> <%= text_field_with_auto_complete :stage, :sujet %>
> <%= submit_tag 'Search' %>
> <%= end_form_tag %><p>
>
> the autocomplete part works great but how can I get the posted value? I
> get a url like '?object%5Bmethod%5D=textvalue'

This'd probably work:

<%= text_field_with_auto_complete :stage, :sujet, :name => 'filter' %>

--
We develop, watch us RoR, in numbers too big to ignore.
This topic is locked and can not be replied to.