richard
September 19, 2006, 11:56pm
1
I have this:
<%= start_form_tag({:action => ‘search’}, :method => “GET”)%>
selected="selected"<%end%>>Sort Alphabetically
selected="selected"<%end%>>Sort by Rating
<%= 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.
richard
September 20, 2006, 12:27am
2
one way is to put the previously set params as hidden fields in this
form.
On 9/19/06, Richard [email protected] wrote:
<%= end_form_tag %>
–
When a man says he approves of something in principle, it means he
hasn’t the slightest intention of putting it into practice. –
Bismarck
richard
September 20, 2006, 1:31am
3
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 C. [email protected] wrote:
<option value="name" <%if params[:sort] == "name"
Bismarck
–
Terry (TAD) Donaghe
http://www.tadspot.com
richard
September 20, 2006, 4:41am
4
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 [email protected] wrote:
–
Posted via http://www.ruby-forum.com/ .
–
Terry (TAD) Donaghe
http://www.tadspot.com
richard
September 20, 2006, 1:57am
5
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?