Hi all, I have a web form: <% form_for @comment do |f| %> <%= f.error_messages %> <p> <%= f.label :author %> <%= f.text_field :author, :size => 20 %> %> </p> <p> <%= f.label :email %> <%= f.text_field :email, :size => 20 %> </p> <% end %> When the validation fails, the labels will be wrapped into <div>, so labels and fields are in different lines, that is not what I want. If you have the agile web development book, please turn to p.151 (the source code is in p.146 and [1]), how did the author archived that? Thanks. Difei 1. http://media.pragprog.com/titles/rails2/code/depot_p/app/views/store/checkout.rhtml -- 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 -~----------~----~----~----~------~----~------~--~---
There''s lots of good info about how to customize the error message output here: http://apidock.com/rails/ActionView/Helpers/ActiveRecordHelper/error_messages_for Difei Zhao wrote:> Hi all, > > I have a web form: > > <% form_for @comment do |f| %> > <%= f.error_messages %> > <p> > <%= f.label :author %> > <%= f.text_field :author, :size => 20 %> %> > </p> > <p> > <%= f.label :email %> > <%= f.text_field :email, :size => 20 %> > </p> > <% end %> > > When the validation fails, the labels will be wrapped into <div>, so > labels and fields are in different lines, that is not what I want. If > you have the agile web development book, please turn to p.151 (the > source code is in p.146 and [1]), how did the author archived that? > Thanks. > > Difei > > 1. > http://media.pragprog.com/titles/rails2/code/depot_p/app/views/store/checkout.rhtml-- 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 -~----------~----~----~----~------~----~------~--~---