Selection List query

I would like to pass the value of a selected item as a parameter in a
url_for().

Here's my code:

<%= select(:picklist, :pick_type, %w{ address number collection }) %>
<%= link_to 'Create', url_for(:action => "new", :property_type =>
@picklist.pick_type) %>

The selection list renders correctly but the parameter value passed
(through url_for) is always 'collection' - fyi, I default :pick_type to
'collection' when a new Picklist object is created.

Thanks.

Lee wrote:

I would like to pass the value of a selected item as a parameter in a
url_for().

Here's my code:

<%= select(:picklist, :pick_type, %w{ address number collection }) %>
<%= link_to 'Create', url_for(:action => "new", :property_type =>
@picklist.pick_type) %>

The selection list renders correctly but the parameter value passed
(through url_for) is always 'collection' - fyi, I default :pick_type to
'collection' when a new Picklist object is created.

Thanks.

The 'link_to' gets rendered at the time the page is loaded and won't
update unless you do some client-side JS, AJAX, or some RJS magic.

You could add an 'onchange' event to your select that will update the
link.

_Kevin