This is really easy and simple but... I have view <%=link_to_remote ''this'', {:url=>{:action=>''action''}, :with => "''name='' + $(''text_field_id'').value" } %> When I''m in the controller, how do I access the variable ''name''? I thought it was params[:name] but that returns nil... Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White
2008-May-26 05:05 UTC
Re: ****[Rails] access variables in controller from link_to_remote
On Mon, 2008-05-26 at 06:32 +0200, s. \ wrote:> This is really easy and simple but... > > I have > view <%=link_to_remote ''this'', {:url=>{:action=>''action''}, :with => > "''name='' + $(''text_field_id'').value" } %> > > When I''m in the controller, how do I access the variable ''name''? I > thought it was params[:name] but that returns nil...---- look in your logs (presumably log/development.log) to see what it was that was posted back to your controller. Craig --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-26 10:09 UTC
Re: ****[Rails] access variables in controller from link_to_remote
On 26 May 2008, at 06:05, Craig White wrote:> > On Mon, 2008-05-26 at 06:32 +0200, s. \ wrote: >> This is really easy and simple but... >> >> I have >> view <%=link_to_remote ''this'', {:url=>{:action=>''action''}, :with => >> "''name='' + $(''text_field_id'').value" } %> >> >> When I''m in the controller, how do I access the variable ''name''? I >> thought it was params[:name] but that returns nil... > ---- > look in your logs (presumably log/development.log) to see what it was > that was posted back to your controller. >In particular that will screw up if your text field contains an ampersand. You should use encodeURIComponent to guard against that. Fred> Craig > > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---