Hello,
I am trying to implement an Ajax Live Search in Rails, but I can’t get
it to work. The problem is that I have more than just one form field
where the user can specify their criteria for the search. Do I need an
observe_field function for each of the form fields. If so, how can I
make this work? Below is the code I’ve been using…
<%= start_form_tag :name => “searchform”, :action => “” %>
Search by Make:
<%= text_field_tag(“make”, @params[‘make’], :size => 10) %>
Search by Style:
<%= text_field_tag(“style”, @params[‘style’], :size => 10) %>
<%= end_form_tag %>
<%= image_tag(“spinner.gif”) %>
<%= observe_field ‘make’, :frequency => 0.5,
:update => 'main',
:before => "Element.show('spinner')",
:success => "Element.hide('spinner')",
:url => {:action => 'list'},
:with => 'make' %>
<%= observe_field ‘style’, :frequency => 0.5,
:update => ‘main’,
:before => “Element.show(‘spinner’)”,
:success => “Element.hide(‘spinner’)”,
:url => {:action => ‘list’},
:with => ‘style’ %>