# Passing multiple parameter through observe\_field

**URL:** <https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765>\
**Category:** Rails\
**Created:** [June 18, 2008, 11:32am UTC](https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765 "2008-06-18T11:32:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![supriyaiiita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@supriyaiiita](https://www.ruby-forum.com/u/supriyaiiita)\
**Post date:** [June 18, 2008, 11:32am UTC](https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765/1 "2008-06-18T11:32:08Z")

</div>

Hi!

Im trying to search through multiple parameters through observe\_field.

Following is my code.: its not showing any result, kindly help…

Filter on Device Name :   
  
Filter on platform :

\<%= image\_tag(“spinner.gif”,  
:align =\> “absmiddle”,  
:border =\> 0,  
:id =\> “spinner”,  
:style =\>“display: none;” ) %\>

\<%= observe\_field ‘search’, :frequency =\> 2,  
:update =\> ‘table’,  
:before =\> “Element.show(‘spinner’)”,  
:success =\> “Element.hide(‘spinner’)”,  
:url =\> {:action =\> ‘trackLocation’},  
:with =\> “‘search=’+ escape($(‘search’).value) + ‘&search1=’ +  
escape(value)”%\>

\<%= render :partial =\> "devices\_list" %\>

and controller looks like:

def trackLocation  
@labs=Labt.find(:all)  
conditions = [“name LIKE ?”, “%#{params[:query]}%”] unless  
params[:query].nil?

@devices=Dev.find(:all,:conditions=\>[“name LIKE ? and platform LIKE ?”,  
“%#{params[:search]}%”,“%#{params[:search1]}%”]).paginate  
:per\_page=\>5,:page=\>params[:page]

#devs\_per\_page=5  
#@devs\_pages, @devs = paginate :devs, :conditions =\> conditions,  
:per\_page  
=\> devs\_per\_page

if request.xml\_http\_request?  
render :partial =\> “devices\_list”, :layout =\> false  
end

## end

View this message in context:  
[http://www.nabble.com/passing-multiple-parameter-through-observe\_field-tp17978823p17978823.html](http://www.nabble.com/passing-multiple-parameter-through-observe_field-tp17978823p17978823.html)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![supriyaiiita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@supriyaiiita](https://www.ruby-forum.com/u/supriyaiiita)\
**Post date:** [June 18, 2008, 11:41am UTC](https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765/2 "2008-06-18T11:41:39Z")

</div>

Supriya A. wrote:

> Hi!
> 
> Im trying to search through multiple parameters through observe\_field.
> 
> Following is my code.: its not showing any result, kindly help…
> 
> Filter on Device Name :   
>   
> Filter on platform :
> 
> \<%= image\_tag(“spinner.gif”,  
> :align =\> “absmiddle”,  
> :border =\> 0,  
> :id =\> “spinner”,  
> :style =\>“display: none;” ) %\>
> 
> \<%= observe\_field ‘search’, :frequency =\> 2,  
> :update =\> ‘table’,  
> :before =\> “Element.show(‘spinner’)”,  
> :success =\> “Element.hide(‘spinner’)”,  
> :url =\> {:action =\> ‘trackLocation’},  
> :with =\> “‘search=’+ escape($(‘search’).value) + ‘&search1=’ +  
> escape(value)”%\>
> 
> \<%= render :partial =\> "devices\_list" %\>
> 
> and controller looks like:
> 
> def trackLocation  
> @labs=Labt.find(:all)  
> conditions = [“name LIKE ?”, “%#{params[:query]}%”] unless  
> params[:query].nil?
> 
> @devices=Dev.find(:all,:conditions=\>[“name LIKE ? and platform LIKE ?”,  
> “%#{params[:search]}%”,“%#{params[:search1]}%”]).paginate  
> :per\_page=\>5,:page=\>params[:page]
> 
> #devs\_per\_page=5  
> #@devs\_pages, @devs = paginate :devs, :conditions =\> conditions,  
> :per\_page  
> =\> devs\_per\_page
> 
> if request.xml\_http\_request?  
> render :partial =\> “devices\_list”, :layout =\> false  
> end
> 
> ## end
> 
> View this message in context:  
> [http://www.nabble.com/passing-multiple-parameter-through-observe\_field-tp17978823p17978823.html](http://www.nabble.com/passing-multiple-parameter-through-observe_field-tp17978823p17978823.html)  
> Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).

Hi…

try the following…

\<%= observe\_field ‘search’, :frequency =\> 2,  
:update =\> ‘table’,  
:before =\> “Element.show(‘spinner’)”,  
:success =\> “Element.hide(‘spinner’)”,  
:url =\> {:action =\> ‘trackLocation’},  
:with =\> “‘search=’+ escape($(‘search’).value) + ‘&’ +  
‘search1=’+  
escape(value)”%\>

---

<div class="post-metadata">

**Author:** ![supriyaiiita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@supriyaiiita](https://www.ruby-forum.com/u/supriyaiiita)\
**Post date:** [June 18, 2008, 11:47am UTC](https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765/3 "2008-06-18T11:47:31Z")

</div>

This also dint helped… basically i want to search through both the  
parameters . …

On Wed, Jun 18, 2008 at 3:11 PM, Suneeta Km \<

---

<div class="post-metadata">

**Author:** ![supriyaiiita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@supriyaiiita](https://www.ruby-forum.com/u/supriyaiiita)\
**Post date:** [June 18, 2008, 11:52am UTC](https://www.ruby-forum.com/t/passing-multiple-parameter-through-observe-field/140765/4 "2008-06-18T11:52:22Z")

</div>

Supriya A. wrote:

> This also dint helped… basically i want to search through both the  
> parameters . …
> 
> On Wed, Jun 18, 2008 at 3:11 PM, Suneeta Km \<

You can pass the value of the element you are observing. what do u mean  
by escape(value)?
