Forum: Ruby on Rails label tag with errors?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Paul B. (Guest)
on 2006-05-08 02:17
(Received via mailing list)
I'd like to create a label tag that has a special css class if has
So Ideally, I'd like:

<%= label('object','property','Property') %>

To generate:

<label for="object_property">Property</label>

And if there are errors on, generate this:

<label for="object_property" class="fieldWithErrors">Property</label>

First of all, is there an easy way to do this?

I'm assuming there isn't, so I thought it shouldn't be too hard to
create my
own helped to do this, but after taking a look at the source for the
tags (text_field, check_box, etc.), it's not clear how to do it.  Any
Paul B. (Guest)
on 2006-05-08 23:52
(Received via mailing list)
any advice on this?  a lable tag that has a different class if the
has errors...
This topic is locked and can not be replied to.