I am trying to use a zend decorator to use custom containers and add css classes on my elements.
$form->setElementDecorators(array(
'viewHelper',
'Errors',
array('Label'),
array(
array('row'=>'HtmlTag'),
array('tag'=>'div', 'class'=>'col-md-6')
)
));
$form->setDecorators(array(
'FormElements',
array(
array('data'=>'HtmlTag'),
array('tag'=>'div', 'class'=>'row')
),
'Form'
));
Is there a way to add a css class directly on my inputs? <input class="form-control">
Is there a way to encapsulate label and input in 2 divs?
Actually i have is
<div class="col-md-6">
<label></label>
<input>
</div>
and what i wish is
<div class="col-md-6">
<div class="form-group">
<label></label>
<input class="form-control">
</div>
</div>
Also where can i found documentation about array to pass to setElementDecorators() function?
Thanks
Try to add
HtmlTagdecorator like this:For all elements, you can add a class like this:
Example to set
form-controlclass:Example to add
form-controlclass: