wilariz wrote
> Hi. I'm trying to create a form with a select element... but when I want
> render I have a message error.
> 
> this is my definition: 
> $this->add(array(
>             'name' => '_subtipo',
>             'attributes' => array(
>                 'type' => 'select',
>                 'class' => 'input-medium',
>                 'options' => array('man'=>1,'woman'=>2)
>             ),
>             'options' => array(
>                 'label' => 'Tipo:',
>             ),
>         ));
> 
> and this is my error :
>  Uncaught exception 'Zend\Form\Exception\InvalidArgumentException' with
> message 'Zend\Form\View\Helper\FormSelect::render requires that the
> element is of type Zend\Form\Element\Select'
> 
> My form work fine because I have other elements that render good.

Try this:
        $this->add(array(
            'type' => 'Zend\Form\Element\Select',
            'name' => '_subtipo',
            'options' => array(
                'label' => 'Tipo:',
                'class' => 'input-medium',
                'value_options' => array('man'=>1,'woman'=>2)
            ),
        ));



-----
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Form-element-select-error-tp4656976p4656978.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to