The insertion of the div only when errors are present is a real pain.   
It would be a lot easier to write CSS to style the forms if the div  
(or span) was there even when there weren't errors, and then changed  
class depending on whether there was an error.  I don't think div vs  
span is a big deal since you can style them to be inline or block as  
you choose.  Usually I end up writing my own form builder class so  
this stuff isn't an issue for me, but the times when I do end up using  
the default form builder my CSS always gets super ugly.

I'm not familiar with how the Merb form generator does things.  Maybe  
it's time for a look.

--
Josh Susser
http://blog.hasmanythrough.com


On Dec 26, 2008, at 3:56 AM, Frederick Cheung wrote:
> The form helpers by default wrap fields with errors in a div with an
> appropriate class. Unfortunately this means that you can't place these
> in <p> tags which many do (including for example the rails scaffold).
> It is a simple change to generate spans instead of divs (or generally
> make any sort of change that seems appropriate).
>
> This may break the appearance of your app, whether it's because of
> style rules attached to div.fieldWithErrors that will no longer apply
> or because the styles that previously applied to broken html look
> different on correct html. Unfortunately this is the sort of breakage
> that is hard to verify automatically. So it seems there are three ways
> forward (not counting the 'do nothing' way:
>
> - change the default settings to generate spans. It's not hard for you
> to change it back to divs in an initializer or something if you need
> it the old way
> - leave the current defaults but have a span based markup in the
> rails3_new_defaults initializer so that new apps will get 'good'
> behaviour
> - the current code sucks and it would be much nicer to have this sort
> of stuff controller by the form builder rather than some setting on
> ActionView::Base (and once you've done that rewrite then you still
> have to decide what actual markup is generated by default)
>
> Opinions appreciated (assuming you're not drunk on christmas cheer)
>
> Fred
>
> Ticket is here 
> http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1626


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to