views:

28

answers:

1

Hi,

How can I add css class to label in Zend_Form?

This is html way:

<dt><label for="foo" class="label-design">Foo</label></dt>

How can I write above row with Zend_Form?

(I know how to write label but i dont know how can i add ccss class.

$model = new Zend_Form_Element_Text('model');
$model->setLabel('Model');

)

Thanks,

+1  A: 

The easiest way is to add class to dt element, not to label:

$model->addDecorator(
    new Zend_Form_Decorator_Label(array('tag' => 'dt', 'class' => 'label-design'))
);

And then just modify your CSS selector from label.label-design to dt.label-design label

Ololo