I am trying to load a page based on an autocomplete entry. In the code snippet below based on selection of a product name, I want the controller to load the product details page. How can I achieve this?

<%= autocomplete_field_tag(‘product_name’,””, “/products/autocomplete_product_name”%>

Solution:

Comment:
Want to see multiple fields from a model in the autocomplete field. For instance I have a model called Product, I would like to see the product price along with the product name in the autocomplete suggestion drop down.

Solution:

Specify the :extra_data option in the autocomplete definition in the controller.

In the controller:
autocomplete :product, :name, :full => true, :display_value => :mydisplay, :extra_data => [:price]

In the view:

<%= autocomplete_field_tag(‘product_name’,”, “/products/autocomplete_product_name”, :update_elements => {:price => ‘#priceid’})%>