lundi 2 mars 2015

Symfony2: select are not updated

I have a form with "choice" (select) fields, and something very strange.


On the POST event, I create my form with available choices, then I:



$form->handleRequest($request);
$data = $form->getData();


So the $data should be updated with the user's values. It works great with all fields except the select.


I tried to debug the Form class. When it iterates over all the fields, the value is found for the select (



$viewData = $this->normToView($normData); on line 644


). Then after all fields are parsed, the form itself does



$viewData = $this->config->getCompound() ? $this->viewData : $submittedData;


There the $viewdata holds the previous value and not the user value. Any idea ?


Aucun commentaire:

Enregistrer un commentaire