Since I have no experience Rails 2, I can't compare the two. However,
it's pretty easy with Rails 3. You can override the default behavior
like so:

ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  *** YOUR CODE HERE ***
end

The README that comes with the ActionPack gem has a more verbose
explanation about this. (I just wish there was a way to tell it to add
some kind of styling if a field validated properly!)

On May 11, 6:08 pm, Mike <[email protected]> wrote:
> Hello, I've been reading that Rails 3 offers a bunch of new validation
> features.
>
> Is there a way to customize the validation error formatting? For
> example, I prefer to style the elements surrounding a form input
> containing an error, not just the input itself.
>
> Also, I might like to define my own class names for styling these
> elements, for example if they don't conform to my naming standards.
>
> Is this easier in Rails 3 than in 2?
>
> I found a few articles about new validation functionality, but they
> seem to be formatting the old way.
>
> Thanks.
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 [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-talk?hl=en.

Reply via email to