Issues

ZF-11859: Zend_Dojo_Form Elements HtmlTag decorator doesn't add ID to dd

Description

Seems the HtmlTag decorator is not setting any id for dd.

dt has an id, but not the dd...

Below is a small sample:


Luna


........


Comments

Seems others are reporting the same issue:

http://stackoverflow.com/questions/7610814/…

Fix is to update Zend_Dojo_Form_Element_Dijit:


    public function loadDefaultDecorators()
    {
        if ($this->loadDefaultDecoratorsIsDisabled()) {
            return;
        }

        $decorators = $this->getDecorators();
        if (empty($decorators)) {
            $this->addDecorator('DijitElement')
                 ->addDecorator('Errors')
                 ->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
                 ->addDecorator('HtmlTag', array('tag' => 'dd'))
                 ->addDecorator('Label', array('tag' => 'dt'));
        }
    }

to


    public function loadDefaultDecorators()
    {
        if ($this->loadDefaultDecoratorsIsDisabled()) {
            return;
        }

        $decorators = $this->getDecorators();
        if (empty($decorators)) {
            $this->addDecorator('DijitElement')
                 ->addDecorator('Errors')
                 ->addDecorator('Description', array('tag' => 'p', 'class' => 'description'))
                 ->addDecorator('HtmlTag', array('tag' => 'dd'))
                 ->addDecorator('Label', array('tag' => 'dt', 'id'  => array('callback' => array(get_class($this), 'resolveElementId'))));
        }
    }

I think


    public static function resolveElementId(Zend_Form_Decorator_Interface $decorator)
    {
        return $decorator->getElement()->getId() . '-element';
    }

should be added as well.