I have this:
<%= start_form_tag({:action => ''search''}, :method =>
"GET")%>
<select name="sort"
onchange=''this.form.submit()''>
<option value="name" <%if params[:sort] == "name"
%>selected="selected"<%end%>>Sort
Alphabetically</option>
<option value="rating" <%if params[:sort] ==
"rating"
%>selected="selected"<%end%>>Sort by Rating</option>
</select>
<%= end_form_tag %>
And I there are some parameters that have previously been set that I
would like to pass to the method here also.
I''ve tried doing the following:
<%= start_form_tag({:action => ''search'', :query =>
params[:query]},
:method => "GET")%>
And also:
<%= start_form_tag({:action => ''search'', :params =>
{:query =>
params[:query]} }, :method => "GET")%>
To no avail.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
one way is to put the previously set params as hidden fields in this form. On 9/19/06, Richard <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have this: > > <%= start_form_tag({:action => ''search''}, :method => "GET")%> > <select name="sort" onchange=''this.form.submit()''> > <option value="name" <%if params[:sort] == "name" > %>selected="selected"<%end%>>Sort Alphabetically</option> > <option value="rating" <%if params[:sort] == "rating" > %>selected="selected"<%end%>>Sort by Rating</option> > </select> > <%= end_form_tag %> > > And I there are some parameters that have previously been set that I > would like to pass to the method here also. > > I''ve tried doing the following: > > <%= start_form_tag({:action => ''search'', :query => params[:query]}, > :method => "GET")%> > > And also: > > > <%= start_form_tag({:action => ''search'', :params => {:query => > params[:query]} }, :method => "GET")%> > > To no avail. > > -- > Posted via http://www.ruby-forum.com/. > > > >-- When a man says he approves of something in principle, it means he hasn''t the slightest intention of putting it into practice. -- Bismarck --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Here''s a link_to_remote tag I have which sends some parameters up to
the
controller:
<%= link_to_remote(image_tag(photo.sizes[0] [''source'']),
:with => "''bigpic="+
photo.sizes[3][''source''] + "&flickrurl="+
photo.owner.photos_url + photo.id + "''",
:before => %(Element.hide(''bigphoto'')),
:update => ''bigphoto'',
:complete => visual_effect(:toggle_blind, ''bigphoto'',
:duration => 1),
:url => {:action => "see_picture"}) %>
The :with => part is where you send the parameters. I think you can use it
with form tags as well, but I''m not sure...
In the :with part above, I have a parameter named "bigpic" and another
named
"flickrurl" seperated by an &.
In the controller you view the parameters like this:
@url = params[''bigpic'']
@flickrurl = params[''flickrurl'']
I''m not sure this will help in your case, but it sounds similar.
Sorry in advance if it doesn''t do any good! :-)
On 9/19/06, Michael Campbell
<michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> one way is to put the previously set params as hidden fields in this form.
>
> On 9/19/06, Richard
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
> >
> > I have this:
> >
> > <%= start_form_tag({:action => ''search''},
:method => "GET")%>
> > <select name="sort"
onchange=''this.form.submit()''>
> > <option value="name" <%if params[:sort] ==
"name"
> > %>selected="selected"<%end%>>Sort
Alphabetically</option>
> > <option value="rating" <%if params[:sort] ==
"rating"
> > %>selected="selected"<%end%>>Sort by
Rating</option>
> > </select>
> > <%= end_form_tag %>
> >
> > And I there are some parameters that have previously been set that I
> > would like to pass to the method here also.
> >
> > I''ve tried doing the following:
> >
> > <%= start_form_tag({:action => ''search'',
:query => params[:query]},
> > :method => "GET")%>
> >
> > And also:
> >
> >
> > <%= start_form_tag({:action => ''search'',
:params => {:query =>
> > params[:query]} }, :method => "GET")%>
> >
> > To no avail.
> >
> > --
> > Posted via http://www.ruby-forum.com/.
> >
> > >
> >
>
>
> --
> When a man says he approves of something in principle, it means he
> hasn''t the slightest intention of putting it into practice. --
> Bismarck
>
> >
>
--
Terry (TAD) Donaghe
http://www.tadspot.com
http://www.rubynoob.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Hrmm.
I''ve looked in the API and it says:
form_tag(url_for_options = {}, options = {}, *parameters_for_url, &proc)
so if I bracket :method => "GET" and then put my parameters in?
What
does the ''*'' symbol mean in this case though?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
I''d have to guess that the * in *parameters_for_url indicates that you can have 0 or more. But that''s just a guess. The Rails API documentation leaves a little to be desired. :-) Terry On 9/19/06, Richard <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hrmm. > > I''ve looked in the API and it says: > > form_tag(url_for_options = {}, options = {}, *parameters_for_url, &proc) > > so if I bracket :method => "GET" and then put my parameters in? What > does the ''*'' symbol mean in this case though? > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Terry (TAD) Donaghe http://www.tadspot.com http://www.rubynoob.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---