# Passing parameters in a form

**URL:** <https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287>\
**Category:** Rails\
**Created:** [September 19, 2006, 11:56pm UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287 "2006-09-19T23:56:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [September 19, 2006, 11:56pm UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287/1 "2006-09-19T23:56:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [September 20, 2006, 12:27am UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287/2 "2006-09-20T00:27:20Z")

</div>

one way is to put the previously set params as hidden fields in this  
form.

On 9/19/06, Richard [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [September 20, 2006, 1:31am UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287/3 "2006-09-20T01:31:27Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

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

–  
Terry (TAD) Donaghe  
[http://www.tadspot.com](http://www.tadspot.com)

> **[太阳集团0638开头的网址✅【欢迎下载】](http://www.rubynoob.com)**
>
> 太阳集团0638开头的网址是一家创办历史悠久并且具有非常高的知名度的在线网娱乐平台为大家提供一个良好的彩票交流平台。

---

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [September 20, 2006, 4:41am UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287/4 "2006-09-20T04:41:43Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Terry (TAD) Donaghe  
[http://www.tadspot.com](http://www.tadspot.com)

> **[太阳集团0638开头的网址✅【欢迎下载】](http://www.rubynoob.com)**
>
> 太阳集团0638开头的网址是一家创办历史悠久并且具有非常高的知名度的在线网娱乐平台为大家提供一个良好的彩票交流平台。

---

<div class="post-metadata">

**Author:** ![richard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f0a364/32.png) [@richard](https://www.ruby-forum.com/u/richard)\
**Post date:** [September 20, 2006, 1:57am UTC](https://www.ruby-forum.com/t/passing-parameters-in-a-form/69287/5 "2006-09-20T01:57:09Z")

</div>

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?
