I am trying to use a CheckBoxType in a form inside a CollectionType but the prototype only contains the label and no checkbox at all !
This is really weird; I don't understand because the symfony documentation here does not mention anything special to do ?
When I click on the button to add a new file I only get the label
What am I missing please?
THE COLLECTION
->add('file', CollectionType::class, array(
'label' => false,
'entry_type' => FileType::class,
'error_bubbling' => false,
'entry_options' => [ 'required' => false, 'error_bubbling' => true, ],
'allow_add' => true,
'allow_delete' => true
))
THE CHECKBOX INSIDE FILETYPE
->add('main', CheckboxType::class,[
'label' => 'Make this one the main picture',
'required' => false,
]);
THE RESULTING PROTOTYPE
data-prototype="<div id=\"new_item_group_pictures_itemFile___name__\"> <div class=\"form-item\"><div class=\"form-label\"></div><div class=\"custom-select\"><input type=\"file\" id=\"new_item_group_pictures_itemFile___name___file\" name=\"new_item[group_pictures][itemFile][__name__][file]\" class=\"form-file\" /></div></div> <div class=\"form-item\"><div class=\"form-label\"><label for=\"new_item_group_pictures_itemFile___name___description\">Description</label></div><input type=\"text\" id=\"new_item_group_pictures_itemFile___name___description\" name=\"new_item[group_pictures][itemFile][__name__][description]\" maxlength=\"255\" class=\"form-input form-text\" /></div> <div class=\"form-item\"><div class=\"form-label\"><label for=\"new_item_group_pictures_itemFile___name___main\">Make this one the main picture</label></div></div></div>"
ENTITY PROPERTY
/**
* @var boolean
* @ORM\Column(type="boolean", nullable=true)
*/
private $main;