One more question.
This decorators I use for rendering <select>
$decorators = array(
'Label',
'ViewHelper',
array('HtmlTag', array('tag' => 'div', 'class' => 'slider'/*, 'placement' =>
'prepend'*/)),
);
rendered:
<div class="slider">
<label for="price" class="optional">xxx:</label>
<select name="price" id="price">
<option value="0" label="0">0</option>
</select>
</div>
I want this:
<label for="price" class="optional">xxx:</label>
<div class="slider">
<select name="price" id="price"> <option value="0" label="0">0</option>
</select>
</div>
How can I hammer it out?
Regards,
Saša Stamenković
On Wed, Sep 30, 2009 at 8:52 AM, Саша Стаменковић <[email protected]>wrote:
> Solution found! Look at the setElementDecorators() description:
> /**
> * Set all element decorators as specified
> *
> * @param array $decorators
> * @param array|null $elements Specific elements to decorate or
> exclude from decoration
> * @param bool $include Whether $elements is an inclusion or exclusion
> list
> * @return Zend_Form
> */
> public function setElementDecorators(array $decorators, array $elements
> = null, $include = true)
>
> there is 2nd parameter, where you can specify which elements to
> include/exclude from setting decorators, so you can aviod owerwriting
> decorators for some desired elements :)
>
> Regards,
> Saša Stamenković
>
>
>
> On Wed, Sep 30, 2009 at 7:49 AM, Саша Стаменковић <[email protected]>wrote:
>
>> *Fatal error*: Call to a member function addDecorator() on a non-object
>> in...
>>
>> Regards,
>> Saša Stamenković
>>
>>
>>
>> On Tue, Sep 29, 2009 at 4:34 PM, alayn <[email protected]> wrote:
>>
>>> Have you tried with something like:
>>>
>>> $form->setElementDecorators(
>>> .
>>> .
>>> .
>>> );
>>> $form->third_element_name->setDecorators(
>>> .
>>> .
>>> .
>>> );
>>>
>>> I think it should work...
>>>
>>> El mar, 29-09-2009 a las 06:46 -0700, umpirsky escribió:
>>> > Hi.
>>> >
>>> > I'm trying to do the following thing.
>>> >
>>> > I have some form, and I'm putting elements on it one by one, when I
>>> finish,
>>> > I call setElementDecorators() to customize rendering. That works
>>> perfect,
>>> > but now I want to add decorator to 3rd element, but
>>> setElementDecorators()
>>> > owerwrites them, if I call setElementDecorators before adding elements,
>>> it
>>> > takes no effect!
>>> >
>>> > How can I achieve this without setting decorators for each element one
>>> by
>>> > one?
>>> >
>>> > Regards,
>>> > Sasa Stamenkovic.
>>>
>>>
>>
>