Getting params form submit_to_remote function

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!

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?)?

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