This is my first attempt at AJAX and I seem to be having a bit of problem. Here is what I have code-wise. In a eda_officer/new.rhtml file I have the call:
Code:
 <tr>
		<td class="td-label" align="right"> Select an Officer</td>
		<td><%= text_field_with_auto_complete :officer, :particulars %></td>
	</tr>
In the eda_officer/eda_officer_controller I have:
Code:
def auto_complete_for_officer_particulars
  @officers = Voters.find_by_sql (["select concat(v.id, ' - ', v.lastname, ', ', v.firstname) as particulars from voters v left join residence r on (v.residence_id=r.id) where v.lastname like ?", '%' + params[:officer][:particulars].downcase + '%' ], :order => 'lastname ASC')
    render :partial => 'officers'
end
and in the eda_officer/_officers.rhtml partial I have
Code:
 <ul class="officers">
<% for officer in @officers do -%>
  <li class="officer">
    <div class="name"><%=h officer.particulars %></div>
    <div class="particulars">
      <span class="informal"><%=h officer.particulars %></span>
    </div>
  </li>
<% end -%>
</ul>
Now this was my first experiment (which failed and that is why I experiment ;) just to see what kind of result would be returned. While I need the name/address information to cue the user what I really need to capture is the voter id so I can save it. If someone can give me some guidance in this area it would be appreciated.

Rick