Hi, I have the following form_for tag that seems to be outputing <div style="margin:0;padding:0"> any suggestions on how this can be stopped? <% form_for :user, :url => user_path(@user), :html => {:method => :put} do |f| %> cheers jon -- 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 -~----------~----~----~----~------~----~------~--~---
Perhaps it adds the div due to compatibility with XHTML? I''m new here, and quite new to Ruby on Rails too, but it seems fairly reasonable that that''s what RoR is doing. One must put a blocking object inside a form for it to be valid XHTML. Valid: <form method="post" action="/somewhere"> <div> <input type="text" name="something" id="something" /> </div> </form> Invalid: <form method="post" action="/somewhere"> <input type="text" name="something" id="something" /> </form> I have no clue how to remove the div-element though, sorry. -- 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 -~----------~----~----~----~------~----~------~--~---
Florian Gilcher
2007-Apr-23 10:24 UTC
Re: why does this add <div style="margin:0;padding:0"> ??
torh wrote:> Perhaps it adds the div due to compatibility with XHTML? I''m new here, > and quite new to Ruby on Rails too, but it seems fairly reasonable that > that''s what RoR is doing. > > One must put a blocking object inside a form for it to be valid XHTML. > > Valid: > <form method="post" action="/somewhere"> > <div> > <input type="text" name="something" id="something" /> > </div> > </form> > > Invalid: > <form method="post" action="/somewhere"> > <input type="text" name="something" id="something" /> > </form> > > > I have no clue how to remove the div-element though, sorry.Yes, it is one of my most hated Rails behaviours. It might be correct to wrap input fields inside a block element, but consider this: <form method="post" action="/somewhere"> <div><label for="something">Test</label> <input type="text" name="something" id="something" /> </div> </form> which is correct xhtml, too. But Rails adds a second (unnecessary) div around the input. It even hinders me in setting a custom class for this div. I think that some of the tag logic needs to be reworked. -- 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 -~----------~----~----~----~------~----~------~--~---