Comments (5)
It's still part of the request data. probably in the POST parameters. Check the profiler or dump($request->request->all());
.
from craueformflowbundle.
@craue Arf, it seems that there are not saved into session. So parameters are lost if I navigate through steps.
In fact, the first step sets some options (not mapped properties) that influence other steps.
Example : if I answer "yes" to a question of the first step, the second step has more fields.
protected function loadStepsConfig()
{
$dataNotMapped = $this->getRequest()->get('property_options');
return [
[
'label' => 'Onboarding',
'form_type' => PropertyOptionsType::class,
'skip' => function($estimatedCurrentStepNumber, FormFlowInterface $flow) use($dataNotMapped) {
return ($estimatedCurrentStepNumber != 1 || $dataNotMapped !== null);
},
],
[
'label' => 'Propriétaire',
'form_type' => PropertyType::class,
'form_options' => [
'host_with_company' => ($dataNotMapped && isset($dataNotMapped['hostWithCompany']) && $dataNotMapped['hostWithCompany']),
]
],
];
}
But, if I click on the "step 2" link label, parameters are lost because there are not in the request anymore.
How can I do that ?
from craueformflowbundle.
What's the reason for not mapping the field? If it's because you're using the flow to "fill" an entity with data but you need additional form fields for proceeding within the flow, you should create a form data class dedicated for this flow which will contain the entity and the additional properties.
from craueformflowbundle.
@craue Yes that is the reason. That is what I done but it does not work. because all data stored in Request are lost if there are an error in the current step and I have an error mesage "Form cannot have extra fields"
protected function loadStepsConfig()
{
$dataNotMapped = $this->getRequest()->get('property');
return [
[
'label' => 'Onboarding',
'form_type' => PropertyType::class,
'skip' => function($estimatedCurrentStepNumber, FormFlowInterface $flow) use($dataNotMapped) {
return false;
},
],
[
'label' => 'Propriétaire',
'form_type' => PropertyType::class,
'form_options' => [
'host_with_company' => ($dataNotMapped && isset($dataNotMapped['hostWithCompany']) && $dataNotMapped['hostWithCompany']),
]
],
]
}
After validating the current step
Because not mapped data stored in Request are lost...
Thanks,
from craueformflowbundle.
If you need submitted form data outside of the current request, map the fields. Take a closer look at property addDriver
in the "create vehicle" flow in the demo bundle: https://github.com/craue/CraueFormFlowDemoBundle/tree/782c3cec1dc1a964afad8a2c5884541bccbf7913/Form
from craueformflowbundle.
Related Issues (20)
- How to navigate freely through the steps ? HOT 2
- Step list structure HOT 9
- Lost data for a 3-steps flow when pressing back button twice then next button HOT 4
- Handle file uploads with Amazon Web service S3 HOT 2
- Bug - Fields not mapped are lost accross steps
- there is no way to hidden the back button (as we had on start over button)
- Event fired Twice (part 2)
- There is any way to add custom new button on last step HOT 2
- Step rendering with Hotwired/Turbo HOT 2
- Don't use this bundle anymore : HOT 3
- Bug - Array field's Data on CollectionType not saved
- Is it still maintained? HOT 1
- Add $stepForm in PreviousStepInvalidEvent
- Call to a member function drop() on null?
- Is there a way to nested form flow? HOT 2
- When redirect after submit is enabled, back and reset buttons don't update URL parameters? HOT 1
- I have 2 forms in a step and i want to display one depending on choice option. How to do that?
- Deprecation Message
- Support Symfony 7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craueformflowbundle.