I bind object  before multichekboks create - it works as it should. However,
I do not understand what has caused this behavior.

public function bind($object, $flags = Form::VALUES_NORMALIZED)
{
    parent::bind($object, $flags); // Bind before, as multicheckbox is
created - it works as it should.

    $this->add([
        'name' => 'roles',
        'type' => 'multicheckbox',
        'options' => [
            'label' => 'Applicable roles',
            'label_attributes' => [
                'class' => 'checkbox',
            ],
            'value_options' => array_combine(
                $object->getRoles(),
                $object->getRoles()
            ),
        ],
        'attributes' => [
            'value' => $object->findApplicableRoles(),
        ],
    ]);

    $spec = $this->getInputFilter();

    $spec->add([
        'name' => 'roles',
        'required' => false,
    ]);

    return $this;
}



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-set-checked-value-in-Multicheckbox-tp4661501p4661502.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