Forum: Ruby on Rails link_to_remote with form values?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
25b8f220c31cb06d10d0f95ac50d6af1?d=identicon&s=25 Se Wa (gorbadica)
on 2006-04-12 20:47
Hi,

I need a way to read a form field and pass its contents as a parameter
to a link_to_remote call.

So let's say I have a textarea input:
<%= text_area 'course', 'topics', :rows => 6, :cols => 60  %>

and later a link_to_remote:
<%= link_to_remote("Hide",
                  { :update => 'my div',
                    :url => {:action => 'hide_textarea', :div =>
'my_div,
                    :course => @course } ) %>

and I want to add the contents of the course_topics textarea as a field
in my :url hash.

Getting the form value with javascript should be possible, but how do I
embed that into the ruby code?

Thanks!
Cf8a610127d1108dfe67f673320b5fe5?d=identicon&s=25 Craig Jolicoeur (craigpj)
on 2006-12-04 18:07
I actually have the very same question and have been trying to figure
out a solution for the last hour.  Any help would be appreciated.
This topic is locked and can not be replied to.