In have the form builder :
$formBuilder->add('customDuplicatedId', TextType::class,
[
'required' => false,
'data' => implode(",", $duplicatedIds),
'mapped' => false,
'help' => "Enter singleCheck Id separate by ',' "
]
)
->add('isDuplicated', ChoiceType::class,
[
'required' => true,
'data' => $entity->getSingleCheck()->isDuplicated(),
'mapped' => false,
'label' => 'Hidden (duplicated)',
'expanded' => true,
'choices' => [
'Yes' => true,
'No' => false,
],
'placeholder' => false
]);
I would like when user choose Yes
, the text input will required. When user choose No
, the text input will not required. How can I do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…