small medium large xlarge

Generic-user-small
29 May 2008, 21:42
Daniel Bozeman (6 posts)

I use form helper to generate my form elements. However, the way it wraps all form elements with a div of class “fieldWithErrors” creates some real headaches with formatting within other divs (namely under Internet Explorer). I’d like to bypass this problem by wrapping the form elements with spans rather than divs. I know this is a touchy subject within the Rails community. I found a way to bypass this by editing the environment.rb file with Rails 1.2:

ActionView::Base.field_error_proc = Proc.new { |html_tag, instance|"<span class=\"fieldWithErrors\">#{html_tag}</span>" }

However, I am using Rails 2.0

Any suggestions would be greatly appreciated!

Generic-user-small
30 May 2008, 19:03
Daniel Bozeman (6 posts)

Actually, this code does work! Some idiot just forgot to restart the web server…

Sorry for posting this in this forum. I realize it is somewhat outside the realm of what is covered in Agile Web Development with Rails. The book is really wonderful though! As far as I know, it is the only good resource for extensive Rails 2 documentation/tutorials I know of. I’m new to Rails, and getting started with version 2 without this book would be next to impossible. Keep up the good work!

You must be logged in to comment