# Getting params form submit\_to\_remote function

**URL:** <https://www.ruby-forum.com/t/getting-params-form-submit-to-remote-function/146200>\
**Category:** Rails\
**Created:** [August 19, 2008, 12:53am UTC](https://www.ruby-forum.com/t/getting-params-form-submit-to-remote-function/146200 "2008-08-19T00:53:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [August 19, 2008, 12:53am UTC](https://www.ruby-forum.com/t/getting-params-form-submit-to-remote-function/146200/1 "2008-08-19T00:53:28Z")

</div>

I’m trying do a search field using XHR form. Look this:

In view:  
\<% form\_tag ‘dub0’ %\>  
\<%= text\_field ‘dub1’, ‘dub2’ %\>  
\<%= submit\_to\_remote ‘btn\_search’, ‘search it’, :url =\> { :action =\>  
‘my\_search\_controller’ }, :update =\> ‘some\_div\_in\_my\_html’ %\>  
\<% end %\>

In controller:

@results = Model.find(:all, :conditions =\> [“some\_object = ?”,  
params[:dub3]]

My several questions are:

What’s need i put in ‘dub0’, is it a general id name (used to format  
html?)?  
What’s need i put in ‘dub1’ and ‘dub2’, is it the id of text\_field and  
…?  
What’s need i put in ‘dub3’, is it …?

## Thanks for your attention!

Regards,

Luiz Vitor Martinez C.  
cel.: (11) 8187-8662  
blog: [rubz.org](http://rubz.org)  
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha  
certeza de  
que eu vou lutar com todas as minhas forÃ§as para ser o melhor engenheiro  
que  
eu puder ser”

---

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [August 19, 2008, 1:09am UTC](https://www.ruby-forum.com/t/getting-params-form-submit-to-remote-function/146200/2 "2008-08-19T01:09:15Z")

</div>

On Aug 18, 11:52 pm, “Luiz Vitor Martinez C.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> @results = Model.find(:all, :conditions =\> [“some\_object = ?”,  
> params[:dub3]]
> 
> My several questions are:
> 
> What’s need i put in ‘dub0’, is it a general id name (used to format html?)?

Strictly speaking you don’t need anything. However it’s nice to put  
the url/url parameters such that if javascript is not available the  
submit will go the the right place

> 

What’s need i put in ‘dub1’ and ‘dub2’, is it the id of text\_field  
and …?  
‘dub1’ should be the name of an instance variable and dub2 a method on  
that object. The text field’s initial value will be @dub1.dub2. I’d  
guess you actually want text\_field\_tag, not text\_field

> What’s need i put in ‘dub3’, is it …?

Simple answer: look in development.log at the parameters that are  
passed.

Fred
