On 11 October 2011 20:38, Jedrin <[email protected]> wrote: > > I have this inside of a template where I have a remote form with the > form fields inside of a table: > <div id='ingredients_div'> > <%= render :partial => 'ingredients', > :locals => {:attr => attr} %> > </div> > > > my "_ingredients.html.erb" template is like so: > > ----------------------------------------- > > > > <tr><td><%= link_to 'Add Ingredient', {:action => > 'add_ingredient', :id =>attr}, :remote => true %> > </td></tr> > > > > <% attr.my_ingredients.each do |ingred| %> > <%= fields_for 'ingredient[]',ingred do |fm| %> > > <tr><td> > <% fld = 'del-' + ingred.id.to_s %> > <%= check_box_tag fld %> > <%= observe_field fld, :frequency => 0.5, > :url => {:action => 'delete_ingredient', :id => ingred} %> > </td></tr> > <tr> > <td>Name</td><td><%= fm.text_field 'ingred_name', :value => > ingred.name %> </td> > </tr> > <tr> > <td>Cas</td><td> <%= fm.text_field 'cas', :value => ingred.cas %> </ > td> > </tr> > <tr><td> </td></tr> > <% end %> > <% end %> > > > ----------------------------- > > my rjs actions try to delete/add an ingredient record or add one and > then re render > the partial like this: > > page.replace_html 'ingredients_div', :partial => > 'ingredients', :locals => {:attr => attr} > > I can't remember if there is some html rule with form fields or table > rules, but the html seems to get modified as the page kind of > twitches, but the fields don't redisplay as they should. The view > source confuses me as it appears the div moved someplace else and left > the old fields intact where they where.
You have not shown us how the form itself is fitted into or around the table. A form cannot lie inside a table unless it is entirely within one cell. A table can lie entirely within a form. If you are not sure whether you have valid html copy the entire page source (View > Page Source or similar in your browser) and paste it into the w3c html validator. Once you have valid html then try the remote stuff again. Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

