I have been trying to pass a collection_select parameter and a text field parameter to observe_field so that it watches both the parameters simultaneously.
but what i can see is , when i select some value from drop down and dont write anything in text field its giving correct results.parameters are also correct passed, but just after that if i write something in text field that value also get passed as collection_select parameter(labtid in my case) my view code is:
<form name="sform" id="myform" action="" style="display:inline;"> <br/>
<label for="dev_name">Filter on Device Name : </label> <%= text_field_tag("query", params['query'], :size => 10 )%>
<label>Lab : </label> <%= collection_select(:labt, :labtid, @labs, :id, :name,:prompt => "Select a Lab") %>
</form> <%= image_tag("spinner.gif", :align => "absmiddle", :border => 0, :id => "spinner", :style =>"display: none;" ) %> </p> <%= javascript_include_tag :defaults %>
<%= observe_field 'query', :frequency => 2, :update => "table", :before => "Element.show('spinner')", :success => "Element.hide('spinner')", :url => {:action => 'trial_location1'}, :with => "'labtid=' + value+'&query='+escape($('query').value)" %> <%= observe_field 'labt_labtid', :frequency => 2, :update => "table", :before => "Element.show('spinner')", :success => "Element.hide('spinner')", :url => {:action => 'trial_location1'}, :with => "'labtid=' + value+'&query='+escape($('query').value)"
%>
<div id="table"> <%= render :partial => "devices_list" %> </div>
i believe the problem lies with :with parameter. Can someone suggest me the problem? Thanking in advance!!