Passing parameters in a form

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.

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

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! :slight_smile:

On 9/19/06, Michael C. [email protected] wrote:

<option value="name" <%if params[:sort] == "name"

Bismarck


Terry (TAD) Donaghe
http://www.tadspot.com
http://www.rubynoob.com

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. :slight_smile:

Terry

On 9/19/06, Richard [email protected] wrote:


Posted via http://www.ruby-forum.com/.


Terry (TAD) Donaghe
http://www.tadspot.com
http://www.rubynoob.com

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs