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.
Patrick A. (Guest)
on 2006-05-14 22: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
Mark Reginald J. (Guest)
on 2006-05-15 15:17
(Received via mailing list)
Patrick A. 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.
Patrick A. (Guest)
on 2006-05-16 21:45
(Received via mailing list)
On 5/15/06, Mark Reginald J. <removed_email_address@domain.invalid> 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
Mark Reginald J. (Guest)
on 2006-05-17 03:45
(Received via mailing list)
Patrick A. 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.