Hi.
Subject sounds simple, but I have big troubles with customizing my forms.
First, I wanted to use default decorators. I'm not a CSS guru, but didn't
manage to make form look like I wanted, because I needed to float elements,
and by default elements are in dt dd tags, which makes label separated from
element, so I dropped default decorators as an option.
So, I'ev created my parent form:
class Automobili_Form_Abstract extends Zend_Form {
public function __construct($options = null) {
parent::__construct($options);
$this->setElementDecorators(array(
'ViewHelper',
'Label',
array('HtmlTag', array('tag' => 'div')),
));
}
public function loadDefaultDecorators(){
if ($this->loadDefaultDecoratorsIsDisabled()) {
return;
}
$this->setDecorators(array(
'FormElements',
'Form'
));
}
}
and similar parent subform (similar decorators).
Now I have elements grouped in divs:
<form method="post" action="/search/result"
enctype="application/x-www-form-urlencoded">
<fieldset id="fieldset-advanced_search_form">
<legend>Osnovni podaci</legend>
<div>
<label class="optional" for="general-brand_button_827">Marka:</label>
<select id="general-brand" class="select-car-brand" name="general[brand]"
style="display: none;">
</select>
</div>
<div>
...
like I wanted, so applying style on fieldset > div or i can add class to div
and select it with class selector.
The problem is now, how to add specific style to only one element div
wrapper in the fieldlist???
I don't have id on this div tags, or anything to select them through CSS. I
tried with n-th child selector, but no luck.
Is there a way to subclass Zend_Form_Element and override
loadDefaultDecorators method? That way I will be able to set id of this div
wrappers. Option to subclass each Zend_Form_Element_* class is a mess,
right. I saw a guy there
http://morecowbell.net.au/2009/10/overriding-zend-form-element-default-decorators-for-good/
doing this:
abstract class Zend_Form_Element_Xhtml extends Tolerable_Form_Element
and that is not good :)
Is there a way around this? How to override element decorators and get ids
like I want?
--
View this message in context:
http://old.nabble.com/Override-Zend_Form_Element-decorators-tp26421495p26421495.html
Sent from the Zend Framework mailing list archive at Nabble.com.