Forum: Ruby on Rails pass text_field_with_auto_complete value into link_to_remote

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.
266f1a5c2a6e62a549bc2ae99ca4b1c2?d=identicon&s=25 Palani Kumar (palani)
on 2008-11-19 14:54
Hi,
   please any one tell me how can i pass the
text_field_with_auto_complete value into link_to_remote in view. Here
are the coding in view .
<%= text_field_with_auto_complete :game, :title%>

 link_to_remote("Find", :url => {:controller => 'account', :action =>
"findyourgame"},:with =>"'game[title]='$('game_title').value")


In my account controller : i have a action called "findyougame"

def findyourgame
    ## i here couldn't get the value like params[:game][:title].
 end


Can any one please tell me how can i pass the text value and get in my
controller by using  link_to_remote. not form submit.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-19 15:05
(Received via mailing list)
On 19 Nov 2008, at 13:54, Palani Kumar wrote:

>
> Hi,
>   please any one tell me how can i pass the
> text_field_with_auto_complete value into link_to_remote in view. Here
> are the coding in view .
> <%= text_field_with_auto_complete :game, :title%>
>
> link_to_remote("Find", :url => {:controller => 'account', :action =>
> "findyourgame"},:with =>"'game[title]='$('game_title').value")

Your with clause is messed up (it needs to be syntactically correct
javascript). You're probably get a javascript error somewhere when you
click on the link.
Something like "'game[title]=' + $('game_title').value"
would probably work better.

Fred
This topic is locked and can not be replied to.