Retrieving data from form inputs

I’m trying to retrieve data from form inputs created using symfony

Here is my FormUploaderType:

class FormUploaderType extends AbstractType
    public function buildForm(FormBuilderInterface $builder, array $options)
            ->add('service', ChoiceType::class, [
                'placeholder'   => 'Wybierz serwis',
                'choices'       => [
                    'home'      => 'home',
                    'az'        => 'az',
                    ''  => 'ionosbg',
                    ''  => 'ionosro',
                    ''  => 'ionoshu',
                'mapped'        => false,
            ->add('date', DateType::class)
            ->add('terms', FileType::class)
            ->add('button', SubmitType::class);

And here how my form is looking in html:

enter image description here

I’m trying to get the data from form_uploader_date inputs, but this line of code:

$date = $form->get('form_uploader')->getData();


$date = $form->get('form_uploader[date]')->getData();

doesnt’ seem to work… I don’t what to do…

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *