Hi all,

For anyone else who experiances a similar problem (IE7 doesn't render
the page correctly when using <select> and a repeating background
image - at least not with my dodgy CSS :D), I resolved the problem by
extending the HtmlTag decorator and the _getCloseTag() method to add a
single space before the closing tag:

class Cit_Form_Decorator_CustomHtmlTag extends Zend_Form_Decorator_HtmlTag
{
        
    protected function _getCloseTag($tag)
    {
        return ' </' . $tag . '>';
    }

}

...

$optionsForm->addPrefixPath('Cit_Form_Decorator',
'Cit/Form/Decorator/', 'decorator');

...

$optionsForm->setElementDecorators(array(
        'ViewHelper',
        array('Description', array('tag' => 'div', 'placement' => 'PREPEND')),
        'Errors',
        'CustomHtmlTag',
        array('Label', array('tag' => 'strong', 'class' => 
'form_element_label')),
 ));

Thanks,
Al

On 22/02/2008, Alan Wagstaff <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Due to an odd bug in IE7 with select dropdowns and background images,
> I need to insert a space (or newline) between my closing </select> tag
> and the </div> that follows it in order for it to display correctly.
>
> Example HTML:
>
> <div><div class="hint">Please select your language</div>
> <select name="language" id="language">
>    <option value="English" label="English" 
> selected="selected">English</option>
> </select></div><br/><div>
>
> My current decorators look like:
>
> // Form decorators
> $optionsForm->setDecorators(array(
>        array('FormElements', array('separator' => '<br />')),
>        array('HtmlTag', array('tag' => 'div', 'class' => 'form')),
>        'Form'
> ));
>
> // Element decorators
> $optionsForm->setElementDecorators(array(
>        'ViewHelper',
>        array('Description', array('tag' => 'div', 'placement' => 'PREPEND')),
>        'Errors',
>        'HtmlTag',
>        array('Label', array('tag' => 'strong', 'class' => 
> 'form_element_label')),
> ));
>
> I still haven't quite figured out this whole decorator thing yet so if
> anyone could assist me in putting a space/newline on my Select element
> it would be much appreciated :)
>
> Thanks,
> Al
>

Reply via email to