Forum: Ruby on Rails Link_to_remote with dynamic textbox

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.
D9d1b31a337f46ac5e4dd56b55404f58?d=identicon&s=25 Dylan Markow (Guest)
on 2006-02-07 19:25
(Received via mailing list)
I'm trying to build a custom spell-checker. When an incorrect word is
found, a select list is populated with suggestions, and when a
suggestion is clicked, a "replacement_text" textbox is populated with
the value. I'd like to be able to use a link_to_remote item to update
the item. However, I can't figure out how to pass the parameter to my
"replace" action in my controller. I've tried:

    link_to_remote(
        suggest_item,
        :update => "id__#{word_count}",
        :url => {
            :action => 'replace',
            :id => word_count,
            :with => "$('replacement_text').value"
        }



but the literal "$('replacement_text').value" gets submitted rather than
the actual value of the "replacement_text" box.
This topic is locked and can not be replied to.