Need help getting value from text_field_with_autocomplete


#1

Good day.

I have setup of a text field with auto complete and I need to grab the
value
from that text field and pass it into a method to update a row in a
table.

Here is the view:

<%= text_field_with_auto_complete( :product, :product_code ) %> <input type="button" id="new_product_button" value="Add New Product to PO" onClick="<%= remote_function(:update => 'new_row', :with => %q('product[product_code]=$('product_product_code')'), :url => { :action => 'addRow' }, :position => :after) %>"

Here is the controller for addRow:

def addRow
@product =
Product.find_by_product_code(params[:product][:product_code])
@completeRow = render_to_string(:partial => ‘complete_row’)
end

Here is the complete_row partial

<%= text_field("purchase_order_detail", "quantity", "size"=>5) %> <%= text_field("product", "product_code", "size"=>30) %>    

I know that the complete_row partial works because I can access it
directly
with a valid product code and get the results I am looking for.
However, when going through the view and the auto_complete, the addRow
find
method never fires.

Any thoughts and assisstance would be greatly appreciated.

Thanks,
~damon