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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---