-- Chris Tankersley <[EMAIL PROTECTED]> wrote
(on Wednesday, 30 July 2008, 12:30 PM -0400):
> I have a few form elements where I want a small 'info' button (just an
> image with an onClick trigger) to appear next to the form element
> itself, but I'm not sure how to go about doing this. Should I extend
> Zend_Form_Element_X or is this something a decorator could handle?
> What I am looking for in the final output is something like this:

In this particular case, I'd use the element's 'description' metadata to
do this:

    $element->setDescription('<img src="/images/info.png" 
onClick="TextBoxInfo();">');

You then need to use this in conjunction with the Description
decorator... and you need to ensure that the Description decorator does
not escape the values:

    $element->setDecorators(array(
        'ViewHelper',
        'Errors',
        array('Description', array('escape' => false)),
        array('HtmlTag', array('tag' => 'dd'),
        array('Label', array('tag' => 'dt'),
    ));

> <dl>
>   <dt>LABEL:</dt>
>   <dd><input type="text" name="TextBox" id="TextBox"> <img
> src="/images/info.png" onClick="TextBoxInfo();"></dd>
> </dl>

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to