Choice list field is not showing in getData function. how to get it?

112 views Asked by At

I don't know what causing problem. I have a form with two field call name and category.

    ->add('name', 'text')
    ->add('category','choice', array(
         'choices' => $options['categories']
    ))

this categroy is a choice list. So here i have a problem, Once i submit this form. I don't get any value of category

but when i change the datatype of category

->add('name', 'text')
->add('category','text')

then i can see the printed array of getData function.

Please help!!! where am i wrong?

FYI, Symfony version 2.5.4 and db engine is innodb with Fk on category.

[EDIT 1]
As i am submitting the form by ajax request and using rest api.

my function call for submitting the form is

$form->submit($parameters, 'PATCH' !== $method);

After submitting i can see only name not category in the printed object.

0

There are 0 answers