symfony - Disable some checkboxes in form -
i wondering if there easy way of how disable 1 checkbox modifying user (symfony 2.1). trying this:
$builder->add('adminroles', 'entity', array( 'property' => 'rolename', 'class' => 'mybundle:role', 'query_builder' => function(entityrepository $er) { return $er->createquerybuilder('r') ->orderby('r.rolename', 'asc'); }, 'disabled' => $this->disabledroles, 'expanded' => true, 'multiple' => true ));
by $this->disabledroles meant array of ids of role entities or entities themselves, seems accepts boolean value applied entities (checkboxes). advice :-)
you need add form listener in order customize individual elements. http://symfony.com/doc/current/cookbook/form/dynamic_form_modification.html
it might seem lot of work it's easy enough once work through examples. end passing disabledroles listener , setting disabled flag accordingly.