-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Description
I get an error message on my first post. Then when I send it again it succeeds.
I couldn't solve the problem. There is a generated dynamically form field in the form.
Could this have an effect? What could be the cause of the problem?
->add('basvurucaptcha', CaptchaType::class,array());
$formModifier = function (FormInterface $form, Il $il = null) {
$ilces = null === $il ? [] : $il->getIlces();
$form->add('ilce', EntityType::class, [
'class' => Ilce::class,
'placeholder' => 'Seçiniz',
'choices' => $ilces,
'disabled'=>count($ilces)==0?true:false,
]);
};
$builder->addEventListener(
FormEvents::PRE_SET_DATA,
function (FormEvent $event) use ($formModifier) {
// this would be your entity, i.e. SportMeetup
$data = $event->getData();
$formModifier($event->getForm(), $data->getIl());
}
);
$builder->get('il')->addEventListener(
FormEvents::POST_SUBMIT,
function (FormEvent $event) use ($formModifier) {
$il = $event->getForm()->getData();
$formModifier($event->getForm()->getParent(), $il);
}
);
Metadata
Metadata
Assignees
Labels
No labels