T
T
Tarakkolya2014-07-10 12:42:36
symfony
Tarakkolya, 2014-07-10 12:42:36

How to explicitly set the name of the form field in symphonic form?

it is necessary that the name was not form[pole], but simply pole. How can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoneFletcher, 2014-07-14
@BoneFletcher

Or via getName of the form class:

class RegisterType extends AbstractType
{
    public function getName()
    {
        return '';
    }
}

Or when creating a form:
instead of
If the form is created without a class:
$form = $this->get('form.factory')->createNamedBuilder('', 'form', $defaultData)
    ->add('name', 'text')
    ->add('email', 'email')
    ->getForm();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question