我正在尝试创建一个包含嵌套集合的表单.我不知道如何处理JS部分来显示子集合.有谁知道我该怎么办?
这是我的表格的代码:
class ParentFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('case', 'choice', array(
'choices' => array(
'case1' => 'case1',
'case2' => 'case2',
'case3' => 'case3',
)))
->add ('subForm1', 'collection', array (
'type' => new Sub1FormType(),
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'prototype' => true,
))
;
$builder->add('save',"submit") ;
}
public function setDefaultOptions(OptionsResolverInterface $resolver) {
}
public function getName() {
return 'formtestparenttype';
}
}
class Sub1FormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, …Run Code Online (Sandbox Code Playgroud)