Two (count 'em) TWO live search boxes

I’m still pretty {color: green;} green when it comes to Ruby on Rails.

I decided that I wanted to have a live search box on the bottom of my theme for the contest. I also want one for the top of my theme.

It’s really pretty easy to mess around in this code. It all just makes sense (assuming you have a good general idea of what’s going on).

Anyway, I just wanted to blog a snippet you can use to have a second live search box in your theme.

<%= start_form_tag({:controller => 'articles',  :action => 'search'}, {:method => 'get', :id => 'sform1'}) %>
 <h3><label for="q">Search</label><input type="text" id="q_bottom" name="q" value="" size="15" /><%= image_tag "theme/spinner.gif", :id => 'search_spinner1', :style => 'display:none;' %></h3>

<%= end_form_tag %>
<%= observe_field "q_bottom", :frequency => 1, 
    :url => { :controller => "live", :action => "search" }, 
    :loading => "'search_spinner1')",
    :complete => "Element.hide('search_spinner1')",
    :update => "search-results1",
    :with => "'q=' + escape($F('q_bottom'))" -%>
<div id="search-results1"></div>

enjoy :D