I am trying to create inline editing in a rails 3.1 project. I create a form to edit a copy via ajax, and then try to submit the edit using ajax.
However, the form does not want to contact and the form will not be submitted to forms created through ajax.
now anyone can link the form after creating
I use edit.js.erb to add a form:
$("#nutri_<%= @nutritioninfo.id %>").after('<%= escape_javascript(render(:partial=>'admin/products/nutrition_edit', :locals=>{:nutritioninfo=>@nutritioninfo}))%>');
and partial - like this:
$%tr.hidden.edit-nutri{ :class => cycle('odd', 'even', :name => "nutrition-hidden-rows"), :id=>"nutri_edit_#{nutritioninfo.id}" } = simple_form_for [:admin,site,product,nutritioninfo], :remote=>true do |f| %td %td= f.input :title,:label => false %td= f.input :parent_id, :as=>:select, :collection=>nutritioninfo.possible_parents,:label => false %td= f.input :per100g, :label => false %td= f.input :info, :label => false %td= f.input :highlight,:as=>:boolean, :label => false %td.edit= f.button :submit, t('admin.general.save').humanize %td.remove=link_to t('admin.general.cancel').humanize, "#", :remote => true, :class=>"cancel-toggle"
Does anyone have an idea on how to link a form?
source share