Damon Hill
2006-Feb-22 00:22 UTC
[Rails] Need help getting value from text_field_with_autocomplete
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: <tr> <td align="center" colspan="6"><%= text_field_with_auto_complete( :product, :product_code ) %></td> </tr> <tr> <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> </tr> 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 <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[#{@ product.id}]" size="30" value="<%= @product.product_name %>"></td> <td align="center"><input type="text" name="unit_price[#{@product.id}]" size="5", value="<%= @product.unit_price %>"></td> <td align="center"><input type="text" name="sell_price[#{@product.id}]" size="5"></td> </tr> <tr> <td align="center"><input type="text" name="unit_weight[#{@product.id}]" size="5", value="<%= @product.unit_weight %>"></td> <td align="center"> </td> <td align="center"> </td> </tr> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060222/89aa64d8/attachment.html
Apparently Analagous Threads
- Customizing autocomplete to update more than one value upon vaule select
- Mailman 'held' messages (was SPAM on List...)
- problems with text_field_with_autocomplete
- Adding RcppFrame to RcppResultSet causes segmentation fault
- strange acts_as_ferret bug in my enviorment