Raimon Fs
2009-Feb-10 18:40 UTC
form_remote_for NOT passing param: I want put and I get post
Hello, I''m struggling my brain with this ajax issue ... Basically I have a form for creating records, and I want to submit it using Ajax. On previous versions of RoR (2.0.2) it was working, but the same methods doesn''t work on 2.2.2, and I started to make changes and changes and read forums and the api, but no way ... <% form_remote_for (:expedient, :url => {:action => ''create_ajax''}, :update =>''div_listd'') do |f| %> <table class="edit"> <tr> <td class="label" width="100px">Referencia</td> <td class="data"><%= f.text_field :reference %></td> <td><%= submit_tag "Añadir" %></td> </tr> </table> <% end %> In the development.log I only see the token param: Parameters: {"authenticity_token"=>"c5fb066b9a3370e15f94154cc2140759d40f079c"} the html source code is this: <form action="/expedients/create_ajax" method="post" onsubmit="new Ajax.Updater(''div_listd'', ''/expedients/create_ajax'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;"><div style="margin:0;padding:0"><input name="authenticity_token" type="hidden" value="c5fb066b9a3370e15f94154cc2140759d40f079c" /></div> <table class="edit"> <tr> <td class="label" width="100px">Referencia</td> <td class="data"><input id="expedient_reference" name="expedient[reference]" size="30" type="text" /></td> <td><input name="commit" type="submit" value="Añadir" /></td> </tr> </table> I see that the method is post, I think it should be ''PUT'' to pass the variables in the params ... or I''m wrong in this assumption ? I tried to add the :method => :put but no way ..... sure I put it in the wrong place :-) thanks again! r. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Feb-10 21:04 UTC
Re: form_remote_for NOT passing param: I want put and I get post
On 10 Feb 2009, at 18:40, Raimon Fs wrote:> > Hello, > > I''m struggling my brain with this ajax issue ... > > Basically I have a form for creating records, and I want to submit it > using Ajax. > > On previous versions of RoR (2.0.2) it was working, but the same > methods > doesn''t work on 2.2.2, and I started to make changes and changes and > read forums and the api, but no way ... >Random guesses: assuming that the page contains more than just this: - are all dom ids unique - have you got nested forms ? Fred> <% form_remote_for (:expedient, :url => {:action => ''create_ajax''}, > :update =>''div_listd'') do |f| %> > > <table class="edit"> > <tr> > <td class="label" width="100px">Referencia</td> > <td class="data"><%= f.text_field :reference %></td> > <td><%= submit_tag "Añadir" %></td> > </tr> > </table> > > <% end %> > > In the development.log I only see the token param: > Parameters: > {"authenticity_token"=>"c5fb066b9a3370e15f94154cc2140759d40f079c"} > > > the html source code is this: > > <form action="/expedients/create_ajax" method="post" onsubmit="new > Ajax.Updater(''div_listd'', ''/expedients/create_ajax'', > {asynchronous:true, > evalScripts:true, parameters:Form.serialize(this)}); return > false;"><div > style="margin:0;padding:0"><input name="authenticity_token" > type="hidden" value="c5fb066b9a3370e15f94154cc2140759d40f079c" /></ > div> > > <table class="edit"> > > <tr> > <td class="label" width="100px">Referencia</td> > <td class="data"><input id="expedient_reference" > name="expedient[reference]" size="30" type="text" /></td> > <td><input name="commit" type="submit" value="Añadir" /></td> > > </tr> > > </table> > > I see that the method is post, I think it should be ''PUT'' to pass the > variables in the params ... or I''m wrong in this assumption ? > > I tried to add the :method => :put but no way ..... sure I put it in > the > wrong place :-) > > thanks again! > > r. > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Raimon Fs
2009-Feb-10 22:08 UTC
Re: form_remote_for NOT passing param: I want put and I get
Frederick Cheung wrote:> On 10 Feb 2009, at 18:40, Raimon Fs wrote: > >> doesn''t work on 2.2.2, and I started to make changes and changes and >> read forums and the api, but no way ... >> > > Random guesses: assuming that the page contains more than just this: > - are all dom ids unique > - have you got nested forms ? > > FredHere is the .erb file: <% form_remote_for (:expedient, :method => :put, :url => {:action => ''create_ajax''}, :update =>''div_listd'') do |f| %> <%= f.error_messages %> <table class="edit"> <tr> <td class="label" width="100px">Referencia</td> <td class="data"><%= f.text_field :reference %></td> <td><%= submit_tag "Añadir" %></td> </tr> </table> <% end %> <br> <h1>Expedientes listos para ser enviados</h1> <div id="div_listd" > <%= render :partial => "list" %> </div> <%= link_to ''General'', :action => ''index'' %> | <%= link_to ''Back'', expedients_path %> -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---