On Fri, Jul 12, 2013 at 1:50 AM, Jigal sanders <[email protected]> wrote:
> Hi I am trying to create radio buttons based on a boolean  in my entities
> like this:
>
>     /**
>      *
>      * visible -> default false
>      * @ORM\Column(type="boolean")
>      * @Annotation\Type("Zend\Form\Element\Radio");
>      * @Annotation\Options({
>      *          "label":"Here are your choices:",
>      *          "value_options":{"1":"Yes", "0":"No"}});
>      */
>     protected $visible;
>
> But it gives this error:
>
>
> Zend\Form\View\Helper\FormMultiCheckbox::render requires that the
> element is of type Zend\Form\Element\MultiCheckbox

A few questions:

- Can you var_dump or inspect the element once you have the form to
determine what object type was created? My guess is that a Radio
element was not created, but I'm curious what _was_.

- Have you tried creating the element manually and rendering it? If
so, does it work? If not, what version of PHP and what version of ZF2
are you using?



> And my stacktrace
>
> Stack trace:
> #0
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\Form\View\Helper\FormMultiCheckbox.php(89):
> Zend\Form\View\Helper\FormMultiCheckbox->render(Object(Zend\Form\Element\Checkbox))
> #1 [internal function]:
> Zend\Form\View\Helper\FormMultiCheckbox->__invoke(Object(Zend\Form\Element\Checkbox))
> #2
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php(400):
> call_user_func_array(Object(Zend\Form\View\Helper\FormRadio), Array)
> #3 C:\wamp\www\myApp\module\MyApp\view\myApp\overview\edit.phtml(11):
> Zend\View\Renderer\PhpRenderer->__call('formRadio', Array)
> #4 C:\wamp\www\myApp\module\MyApp\view\myApp\overview\edit.phtml(11):
> Zend\View\Renderer\PhpRenderer->formRadio(Object(Zend\Form\Element\Checkbox))
> #5
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php(507):
> include('C:\wamp\www\kas...')
> #6
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\View\View.php(205):
> Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
> #7
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\View\View.php(233):
> Zend\View\View->render(Object(Zend\View\Model\ViewModel))
> #8
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\View\View.php(198):
> Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
> #9
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(102):
> Zend\View\View->render(Object(Zend\View\Model\ViewModel))
> #10 [internal function]:
> Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
> #11
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468):
> call_user_func(Array, Object(Zend\Mvc\MvcEvent))
> #12
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207):
> Zend\EventManager\EventManager->triggerListeners('render',
> Object(Zend\Mvc\MvcEvent), Array)
> #13
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(347):
> Zend\EventManager\EventManager->trigger('render', Object(Zend\Mvc\MvcEvent))
> #14
> C:\wamp\www\myApp\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(322):
> Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
> #15 C:\wamp\www\myApp\public\index.php(12): Zend\Mvc\Application->run()
> #16 {main}
>
>
>
> Any idea's why it's trying to create a multiCheckbox in stead of radio
> buttons?
>
>
>
>
>
>
> kind regards,
>
>
> Jigal



--
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

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


Reply via email to