ActiveLabel for ActiveRadioButton


As far as I know, there is no HTML tag to associate a label with a group of RadioButtons. However, for the sake of consistensy, I would like to use ActiveLabel to display the name of the associated attribute.

Unfortunately, ActiveLabel does produce an incorrect reference in its for attribute. The validator then says "reference to non-existent ID" and my page is not valid XTML.

Is there a way to tell ActiveLabel not to output a for attribute? (Or any other simple and Yii-style way to get around this problem?)

PS. It is "only" a warning, not an error. So technically, the page is valid.

You can set ‘for’ option in the last parameter to explicitly specify which element your label needs to associate with.

But I can’t make it to omit the for attribute. Setting it to ‘for’=>null creates a for with the standard target. Setting it to ‘for’=>’’ creates a for="", wich is not valid.

The output I am looking for is

<label>Autoamtically determined attribute label</label>

without any for attribute.

ok, I just checked in a fix so that you can set ‘for’=>false to hide the ‘for’ attribute.

Wow, that was fast! Thanks a lot!