Forum: Ruby on Rails Live Search problems - HELP

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
rh (Guest)
on 2006-03-18 02:53
I'm trying to make a live search for my site.  Nothing is working, and
I'm getting a javascript error that says "Form is not defined", but I
don't think that's my only problem.

This is my view:

  <%= form_remote_tag(
      :url => {:controller => 'inventory', :action => 'search'},
      :update => "results" )%>
    <input type="text" id="search" name="search" size="40" value="" />
    <img id="loading" src="/images/loading.gif" alt="Loading..."
     none;" />
  <% end_form_tag %>

  <%= observe_field( 'search', :frequency => 0.5,
      :url => {:controller => 'inventory', :action => 'search'},
      :update => :results,
      :loading => "'loading');",
      :complete => "Element.hide('loading');",
      :with => "'search=' + escape($F('search'))"
      ) %>

  <div id="results"></div>

Here's my controller:

  def search
    if @params['search']
    @items = Content.find(:all,
             :conditions => [ 'LOWER(post) LIKE ? or LOWER(title) LIKE
                '%' + @params['search'].downcase + '%',
                '%' + @params['search'].downcase + '%'],
             :order => "id desc")
    @mark_term = @params['search']

This might be way off, but I'm trying to follow examples and what I
*think* might work.  I can't get anything at all so far, though.

Can someone please help me out???

This topic is locked and can not be replied to.