I use Sonata Admin Bundle in my Symfony2 project. In one form, I have a list of choice containing two items, 'article' and 'event', and a date field, which is relevant only if 'event' is selected in the list.
How can I disabla/enable according to which value in the list is selected?
Here is my relevant code :
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('title', null, array(
'label' => 'Titre',
))
->add('type', 'choice', array('choices' => array('0' => 'Article', '1' => 'Evénement',)) )
->add('gameDate', null, array('required' => false));
}
Thank you for your help.