raimon
February 10, 2009, 7:40pm
1
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| %>
Referencia
<%= f.text_field :reference %>
<%= submit_tag "Añadir" %>
<% end %>
In the development.log I only see the token param:
Parameters:
{“authenticity_token”=>“c5fb066b9a3370e15f94154cc2140759d40f079c”}
the html source code is this:
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.
raimon
February 10, 2009, 10:05pm
2
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 ?
Fred
raimon
February 10, 2009, 11:08pm
3
Frederick C. 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 ?
Fred
Here is the .erb file:
<% form_remote_for (:expedient, :method => :put, :url => {:action =>
‘create_ajax’}, :update =>‘div_listd’) do |f| %>
<%= f.error_messages %>
Referencia
<%= f.text_field :reference %>
<%= submit_tag "Añadir" %>
<% end %>
Expedientes listos para ser enviados
<%= render :partial => "list" %>
<%= link_to ‘General’, :action => ‘index’ %> |
<%= link_to ‘Back’, expedients_path %>