我将以下字段添加到我的表单中:
->add('interessi_profilo', 'entity', array(
'label' => 'Interessi (Tr)',
'class' => 'MyProfiloBundle:TipoInteresse',
'required' => true,
'multiple' => true,
'expanded' => true,
'property' => 'tipo',
'query_builder' => function(\My\ProfiloBundle\Entity\TipoInteresseRepository $er) {
return $er->createQueryBuilder('u')
->orderBy('u.id', 'ASC');
},
我希望仅在至少选中一个复选框时才发送表单,并且如果可能的话,有一个告诉用户的工具提示:at least one option must be selected