Emagister / zend-form-decorators-bootstrap

Zend_Form decorators for Twitter's Bootstrap UI
http://emagister.github.com/zend-form-decorators-bootstrap
168 stars 79 forks source link

Invalid HTML when using Twitter_Bootstrap_Form #31

Closed renecatharsis closed 12 years ago

renecatharsis commented 12 years ago

Hi,

when generating a form via extending Twitter_Bootstrap_Form, invalid HTML gets generated. Within the FORM tag are DD tags and DT tags, but the surrounding DL tag is missing:

form dt dd dt dd form

theUniC commented 12 years ago

Hi,

Can you paste an example in order to reproduce the issue?

Thanks! Christian.

renecatharsis commented 12 years ago

Hi Christian,

of course, should have done that earlier anyway:

<?php
class Default_Form_Register extends Twitter_Bootstrap_Form
{
    public function init()
    {
        $this->addElement(
            'text',
            'someelement',
            array(
                'label' =>TEXT_FOR_THIS_ELEMENT
            )
        );

        $this->addElement(
            'button',
            'somebutton',
            array(
                'label'      => 'TEXT_FOR_THIS_BUTTON',
                'type'       => 'submit',
                'buttonType' => 'success',
                'icon'       => 'ok'
            )
        );
    }
}
theUniC commented 12 years ago

Hi,

I think you should use one of the form variants in order to get the correct HTML, instead of extending the base Twitter_Bootstrap_Form class.

Try to extend one of this classes Twitter_Bootstrap_Form_Horizontal, Twitter_Bootstrap_Form_Vertical, Twitter_Bootstrap_Form_Search or Twitter_Bootstrap_Form_Inline.

Regards, Christian.