Matthew Weier O'Phinney wrote:
> -- Bruno Friedmann <[EMAIL PROTECTED]> wrote
> (on Tuesday, 26 August 2008, 09:50 AM +0200):
>> Hi All, I have to ask for this because not found anything in archives nor 
>> Google or Yahoo.
>>
>> I need to have a label ( for a select element in Zend_Form )
>> this label must contain a link like this
>>
>> <a href="#" onclick="javascript: alert('thing');">More</a>
>>
>>
>> $mylink = '<a href="#" onclick="javascript: alert('thing');">More</a>';
>>      
>> $element = new Zend_Form_Element_Select('partnerid');
>> $element->addMultiOptions($this->partners_array)
>>         ->setRequired(true)
>>         ->setLabel( 'this is normal text' . $mylink )
>>         ->setAttrib('size', 1)
>>         ->setAttrib('maxlength', 1)
>>         ->setAttrib('onclick', 'javascript: ShowPartnerDetails(); return 
>> false;')
>>         ->addFilter($filterTags)
>>         ->addFilter($filterTrim)
>>         ->addValidator($validatorNotEmpty, true)
>>         ->addValidator($validatorNum, true)
>>         ->setValue(1)
>>         ;
>> $this->addElement($element);
>>
>> Of course like this it's render with htmlentities ( did I mention I hate it 
>> :-)
>>
>> I couldn't be able to find how to make this or which method & options I've 
>> to call.
>>
>> Has someone a way ?
> 
> After you've setup the element, grab the label decorator:
> 
>     $decorator = $element->getDecorator('Label');
> 
> and then tell it not to escape:
> 
>     $decorator->setOption('escape', false);
> 
> Alternately, you can do this at configuration time when setting up the
> decorator -- add an additional 'escape' option to pass to it.
> 
> And that's all there is to it.
> 

I knew that's the anwser would be simple ... :-)

Thanks, in one or two month with lot's forms builded I will understand all 
subtle details of Zend_Form

Many thanks for this ...


-- 

     Bruno Friedmann

Reply via email to