Forum: Ruby on Rails Need help getting value from text_field_with_autocomplete

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Damon H. (Guest)
on 2006-02-22 02:24
(Received via mailing list)
Good day.

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

Here is the view:

        <td align="center" colspan="6"><%=
:product, :product_code ) %></td>
        <td colspan="6" align="center"><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) %>"</td>

Here is the controller for addRow:

def addRow
    @product =
    @completeRow  = render_to_string(:partial => 'complete_row')

Here is the complete_row partial

<td rowspan="2" align="center"><%= text_field("purchase_order_detail",
"quantity", "size"=>5) %></td>
<td rowspan="2" align="center"><%= text_field("product", "product_code",
"size"=>30) %></td>
<td rowspan="2" align="center"><input type="text" name="product_name[#{@}]" size="30" value="<%= @product.product_name %>"></td>
<td align="center"><input type="text" name="unit_price[#{}]"
size="5", value="<%= @product.unit_price %>"></td>
<td align="center"><input type="text" name="sell_price[#{}]"
<td align="center"><input type="text" name="unit_weight[#{}]"
size="5", value="<%= @product.unit_weight %>"></td>
<td align="center">&nbsp;</td>
<td align="center">&nbsp;</td>

I know that the complete_row partial works because I can access it
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
method never fires.

Any thoughts and assisstance would be greatly appreciated.

This topic is locked and can not be replied to.