Closed ValBrunhes closed 8 years ago
$formData = new CreateVisite(); $flow = $this->get('spanc.form.flow.visite'); $flow->bind($formData); $form = $flow->createForm(VisiteType::class, $formData, ['id' => $id]);`
Sorry here is my code
For 2.1, createForm
has only one argument $options
. For upcoming 3.0, see https://github.com/craue/CraueFormFlowBundle#passing-generic-options-to-the-form-type.
If i use method:
$flow->setGenericFormOptions(array('action' => 'targetUrl'));
how can i fetch the parameter inside step forms or inside the flow (so i can pass it to form types via form_options)?
@andrzejdziekonski, these options will be passed to the form type of each step. You don't need to pass them manually.
I see. What about third party parameters? Let's say i need to pass some parameter (i.e. 'locale') for my first step form field to filter collection with this param. With setGenericFormOptions method i get error that option '...' does not exist. What is the best way to achieve that?
@andrzejdziekonski, see https://github.com/craue/CraueFormFlowBundle#passing-step-based-options-to-the-form-type.
I know i can pass parameters to form via form_options but question is how to pass dynamic ('locale' param is depending on user geo) parameter from controller to flow since i create the flow instance from service?
@andrzejdziekonski, then you'd need to override getFormOptions
as shown in the section mentioned previously.
Hi, I'm a beginner with symfony and I'm trying to pass a value from my controller to my buildForm like this: http://stackoverflow.com/questions/29811837/symfony2-passing-options-to-buildform but it doesn't work. Any tips how could i resolve this issue?