I need radio button with field other and when user select other and write some text in field and submit form I set this is text in field. I have form:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('reason', 'choice', array(
'choices' => array(
'I’m not interested in projects, I receive here' => 'I’m not interested in projects, I receive here',
'I really don’t like your service' => 'I really don’t like your service',
'I never signed up for this mailing list' => 'I never signed up for this mailing list',
'I no longer want to receive these emails' => 'I no longer want to receive these emails',
'other' => 'other'
),
'multiple' => false,
'expanded' => true,
'required' => true
))
->add('submit', 'submit');
;
}
in twig
{{ form_start(form, {'action': path('developers_resubscribe', {'token': token, 'id': unsubscribe.id }), 'method': 'POST'}) }}
{{ form_errors(form) }}
{{ form_row(form.reason) }}
{{ form_row(form.submit, { 'label': 'Submit me' }) }}
{{ form_end(form) }}
and I not understand how its add in this form field when user select other for user reason - like this screen
And my action:
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
$em->persist($unsubscribe);
$em->flush();
return $this->redirect($this->generateUrl('developers_resubscribe', array('token' => $token, 'id' => $unsubscribe->getId())));
}
}
Help please