【发布时间】:2018-04-23 19:44:58
【问题描述】:
在 Symfony3 项目中,我有一个像这样的 SonataAdminBundle 表单:
protected function configureFormFields(FormMapper $formMapper) {
$formMapper->add('rentalTime', 'choice', array(
'label' => 'Durée de location',
'multiple' => false,
'choices' => array(
'3H' => '3',
'24H' => '24',
)
));
$formMapper->add('rentalTimeType', 'choice', array(
'label' => 'Type de durée de location',
'multiple' => false,
'choices' => array(
'Heure(s)' => 'H',
'Plage de jours' => 'R'
)
));
.
.
.
当我更改rentalTime 的值时,我想更改rentaltimeType 的值。 示例:如果我在 rentTime 字段中选择 24H 并自动更改“Plage de jours”的rentalTimeType。
我已经阅读了很多关于使用 $subject 的主题,但这并不是我所需要的。
- change row color in sonata admin bundle dependent on a value of a field
- Correct way to use FormEvents to customise fields in SonataAdmin
- Sonata User Admin - Custom field dependency
那么有可能做我需要的吗?
【问题讨论】:
标签: php symfony sonata-admin symfony3.x