Stan McFarland
2006-Mar-08 16:03 UTC
[Rails] Difficulty with params hash and submit_to_remote
Hi, Is there any trick to initializing the params hash via submit_to_remote()? I have a form with two submit methods - the regular, non-AJAX method, and the AJAX method. The regular method works like a champ. The submit_to_remote invokes the correct controller, but the params hash is empty except for the values for :action and :controller. I''d show my code, but it''s on an internal network and I can''t cut-and-paste. Thanks, -stan
Kevin Olbrich
2006-Mar-08 16:50 UTC
[Rails] Difficulty with params hash and submit_to_remote
Nothing magic here, just add the other parameters to the remote_function or link_to_remote calls like this.. <%= link_to_remote "Link", :update=>''updatediv'', :controller=>''controller'', :action=>''action", :id=>object.id, :other =>''other stuff'' %> Things like other should now be in the params array for the recieving action _Kevin On Wednesday, March 08, 2006, at 3:58 PM, Stan McFarland wrote:>Hi, > >Is there any trick to initializing the params hash via >submit_to_remote()? I >have a form with two submit methods - the regular, non-AJAX method, >and the >AJAX method. The regular method works like a champ. The submit_to_remote >invokes the correct controller, but the params hash is empty except >for the >values for :action and :controller. > >I''d show my code, but it''s on an internal network and I can''t >cut-and-paste. > >Thanks, > >-stan > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails-- Posted with http://DevLists.com. Sign up and save your time!
Stan McFarland
2006-Mar-08 18:20 UTC
[Rails] Re: Difficulty with params hash and submit_to_remote
Kevin Olbrich wrote:> Nothing magic here, just add the other parameters to the remote_function > or link_to_remote calls like this..ok, I''m confused (but I *am* a newbie!). I thought the whole idea with submit_to_remote() was to make the contents of a form available to the controller in the params hash, just as if I had submitted it via non-AJAX form. Otherwise, I could have just called link_to_remote() instead. Any suggestions? -- Posted via http://www.ruby-forum.com/.
Kevin Olbrich
2006-Mar-08 19:13 UTC
[Rails] Re: Difficulty with params hash and submit_to_remote
It would help if I actually read your question right. Take a close look at the API for submit_to_remote... if you also read the docs for form_remote_tag. This indicates that there is a way to set it up to fallback to a normal submit if JS is disabled. You shouldn''t need wo submit mechanisms. I haven''t actually used this yet, so I can''t help much more than that. _Kevin On Wednesday, March 08, 2006, at 7:19 PM, Stan McFarland wrote:>Kevin Olbrich wrote: >> Nothing magic here, just add the other parameters to the remote_function >> or link_to_remote calls like this.. > >ok, I''m confused (but I *am* a newbie!). I thought the whole idea with >submit_to_remote() was to make the contents of a form available to the >controller in the params hash, just as if I had submitted it via >non-AJAX form. Otherwise, I could have just called link_to_remote() >instead. > >Any suggestions? > > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails-- Posted with http://DevLists.com. Sign up and save your time!
Stan McFarland
2006-Mar-08 19:21 UTC
[Rails] Re: Difficulty with params hash and submit_to_remote
Kevin, Thanks. Believe it or not, it was a missing </div> tag in the view that was preventing the form values from being passed. -stan Kevin Olbrich wrote:> It would help if I actually read your question right. > > Take a close look at the API for submit_to_remote... if you also read > the docs for form_remote_tag. This indicates that there is a way to set > it up to fallback to a normal submit if JS is disabled. You shouldn''t > need wo submit mechanisms. > > I haven''t actually used this yet, so I can''t help much more than that. > > _Kevin-- Posted via http://www.ruby-forum.com/.
Christian Rolle
2007-Jan-12 10:42 UTC
Re: Difficulty with params hash and submit_to_remote
Hi guys, i''ve got the same problem. But in my situation I have to send values of text-inputs via submit_to_remote() to my controller. I don''t know how to get the value of this text-input: <%= text_field_with_auto_complete(:vorgang, :bez, {:value => ''****''}, {:skip_style => true} ) %> to my controller: def filterDatensatz() tmp = params[:vorgang][:bez] my_redirect_to(:action => ''list'', :tmp => tmp) end params[:vorgang] is always nil. Can you help me? Greetings Chris -- 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 -~----------~----~----~----~------~----~------~--~---
try something like this: rhtml: <%= text_field_with_auto_complete :person, :nachname, {}, { :select => ''name'', :after_update_element => "function(element,value) " + "{ " + remote_function(:update=>''Kundendaten'', :url=>{:action=>:update_kundendaten}, :with=>"''adr_id=''+value.id") + ";" + "}" } %> controller: def update_kundendaten #params[:adr_id] should be ok in controller end but with this solution i have the problem that the autocomplete is only working on IE. FF wont show the autocomplete popup. :( HTH On 12 Jan., 11:42, Christian Rolle <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi guys, > > i''ve got the same problem. But in my situation I have to send values of > text-inputs via submit_to_remote() to my controller. I don''t know how to > get the value of this text-input: > <%= text_field_with_auto_complete(:vorgang, :bez, {:value => ''****''}, > {:skip_style => true} ) %> > > to my controller: > > def filterDatensatz() > tmp = params[:vorgang][:bez] > my_redirect_to(:action => ''list'', :tmp => tmp) > end > > params[:vorgang] is always nil. > > Can you help me? > > Greetings > Chris > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---