My observe_form is basically totally limp. I think it should update without hitting submit button but even if I hit it , it doesn’t change (doesn’t seem to post the data). Can anyone please take a look and see if I"m doing something wrong. TIA
Form: <% start_form_tag({:action => “livesearch”}, :id => “asearch”) %>
<select name=“cat”, @params[‘cat’],size=“2” multiple=“multiple”><%= options_from_collection_for_select @categories, :id, :name %>
State Terms Titleenter in as many titles as you wish seperated by a comman
<%= text_field("title", @params['title'], :size => 10) %> Cityenter in as many cities as you wish seperated by a comman
<%= text_field("city", @params['city'], :size => 10) %><%= submit_tag ‘livesearch’ %> <% end_form_tag %>
<%= observe_form “asearch”, :frequency => 1, :update => “table”, :with => “Form.serialize(asearch)”, :complete => “Element.show(‘table’)”, :url => { :action => “livesearch” } %>
Controller:
def livesearch @categories = Category.find(:all, :order => “name”) @states = State.find(:all, :order => “name”) @terms = Term.find(:all, :order => “name”)
params[:cat]
params[:stat]
params[:term]
params[:city]
params[:title]
pq = Position.query # the syntax is because I"m using a plugin CriteriaQuery, a find wrapper. pq.category_id_in(params[:cat]) if params[:cat] pq.state_id_in(params[:stat]) if params[:stat] pq.term_id_in(params[:term]) if params[:term] pq.city_in(params[:city].split(‘,’)) if params[:city] pq.title_in(params[:title].split(‘,’)) if params[:title] @positions = pq.find
if request.xml_http_request? render :partial => “positions_list”, :layout => false end end
end