Formatting of validation errors

Rails seems to expect views to contain one form field per line. I have several views that put multiple input fields on a single line (e.g. for phone number components). As an example:

    <p>         <%= f.label 'Phone: ' %>         (<%= f.text_field :phone_areacode, :maxlength=>3 %>)         <%= f.text_field :phone_prefix, :maxlength=>3             %>-<%= f.text_field :phone_suffix, :maxlength=>4 %>         <%= f.label 'Ext.' %>         <%= f.text_field :phone_extension, :maxlength=>5 %>*     </p>

When validation fails, rails displays fieldwitherror divs that format these concatenated lines as separate lines, confusing the intent of the layout. I edited the scaffold.css to try to fix this by changing .fieldWithErrors from "display: table" to "display: inline-table", but while that fixed *most* fields it doesn't seem to prevent line breaks on the '(' character.

I've gone about as far as my current knowledge allows in tracking down what's causing this formatting issue. How can I keep the entire set of fields on one line when reporting errors?

Take a look at customizing the ‘ActionView::Base.field_error_proc proc’ in your environment.rb file. Here is a post will an example: http://blog.cosmoknot.com/?p=77

Darian Shimy

Yeah, that's a pretty big weakness of ActionView...simply adding a css class to the tag would be great but it doesn't look trivial.