I think after 3 days I"m getting closer to getting my observe_form to work. At least now it’s rendering the partial , only with a nomethod (nil) error. Here is the problem → I don’t think I know how to grab the params correctly off the form.
Here is the form -
<%= image_tag(“roller.gif”, :align => ‘center’, :border => 0, :id => “roller”, :style => “display: none;”) %>
<%= observe_form “asearch”, :frequency => 0.5, :update => ‘table’, :before => “Element.show(‘roller’)”,
:success => "Element.hide('roller')",
:url => 'list',
:with => "asearch" %>
From the server log , the parameters being sent - Parameters: {“asearch”=>“position[state_id]=35”, “action”=>“list”, “controller”=>“ajaxsearch”, “position”=>{“city”=>“Boston”, “title”=>“”, “term_id”=>[“3”]}}
So the user can pick any number of choices in any number of elements
One thing that looks weird in the parameters above is - “asearch”=>“position[state_id]=35” as opposed to “position”=>{“city”=>“Boston” and “term_id”=>[“3”]}
anyway since the label names are position[field] in the controller I did a
@positions = Position.new(params[:position])
Yes as I said above getting a nil error on the finds.
Anyone ?
Stuart