Hi! Im trying to search through multiple parameters through observe_field. Following is my code.: its not showing any result, kindly help.. <label for="dev_name">Filter on Device Name : </label> <input id="search" name="search" type="text" value=""> <label for="dev_platform">Filter on platform : </label> <input id="search1" name="search1" type="text" value=""></form> <%= image_tag("spinner.gif", :align => "absmiddle", :border => 0, :id => "spinner", :style =>"display: none;" ) %> </p> <%= 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 id="table"> <%= render :partial => "devices_list" %> </div> 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 Sent from the RubyOnRails Users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Supriya Agarwal wrote:> Hi! > > Im trying to search through multiple parameters through observe_field. > > Following is my code.: its not showing any result, kindly help.. > > <label for="dev_name">Filter on Device Name : </label> > <input id="search" name="search" type="text" value=""> > <label for="dev_platform">Filter on platform : </label> > <input id="search1" name="search1" type="text" value=""></form> > > <%= image_tag("spinner.gif", > :align => "absmiddle", > :border => 0, > :id => "spinner", > :style =>"display: none;" ) %> > </p> > > <%= 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 id="table"> > <%= render :partial => "devices_list" %> > </div> > > > 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 > Sent from the RubyOnRails Users mailing list archive at 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)"%> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
supriya agarwal
2008-Jun-18 09:46 UTC
Re: passing multiple parameter through observe_field
This also dint helped.. basically i want to search through both the parameters . .. On Wed, Jun 18, 2008 at 3:11 PM, Suneeta Km < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Supriya Agarwal wrote: > > Hi! > > > > Im trying to search through multiple parameters through observe_field. > > > > Following is my code.: its not showing any result, kindly help.. > > > > <label for="dev_name">Filter on Device Name : </label> > > <input id="search" name="search" type="text" value=""> > > <label for="dev_platform">Filter on platform : </label> > > <input id="search1" name="search1" type="text" value=""></form> > > > > <%= image_tag("spinner.gif", > > :align => "absmiddle", > > :border => 0, > > :id => "spinner", > > :style =>"display: none;" ) %> > > </p> > > > > <%= 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 id="table"> > > <%= render :partial => "devices_list" %> > > </div> > > > > > > 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 > > Sent from the RubyOnRails Users mailing list archive at 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)"%> > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Supriya Agarwal 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)? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---