craue / CraueFormFlowBundle

Multi-step forms for your Symfony project.
MIT License
736 stars 118 forks source link

Form data has not been evaluated yet and thus cannot be accessed. #366

Closed bjjclimbing closed 3 years ago

bjjclimbing commented 3 years ago

Hello.

I am experiencing an issue when trying to submit a step of a form. My application has 2 forms, each one has a flow, a type and a service which persists it on the database (it's a service because the form holds data form several entities) . Also each form is called from it's own controller , since i upgraded my symfony version to 4.2 i am using dependency injection on the controller in order for it to access it's flow form . One of my forms works great, it persists the data perfectly and the multistep flow works like a charm. The problem is on the second form, this form is handled from another controller and the configuration is pretty much like the other one, only it has a different flow and a type , so when the form is loaded, it shows the fields that need to be filled , but when i click the "next" button i get and error that says "Form data has not been evaluated yet and thus cannot be accessed." the weird thing is that the debugger says that the flow it is evaluating is the one from the other form

bjjclimbing commented 3 years ago

BTW i am using Symfony 4.4

craue commented 3 years ago

That sounds like something's mixed up. Please double check your code.

bjjclimbing commented 3 years ago

Thanks a lot for your reply! i am going to start over and i will post what i was doing wrong on this same ticket.

bjjclimbing commented 3 years ago

I have checked my code and the problem is on the eventSubscriberInterface, i have 2 forms created on my project, each form follows it's own flow where both use implement EventSubscriberInterface to persist the saved data on the database. My problem is that when i complete a form and then go and try to fill the other one, the second one crashes on step 2 with the message "Form data has not been evaluated yet and thus cannot be accessed" the weirdest part is that the flow that tries to validate this form is the one configured for form1 . Is there a way to keep the eventSubscriberInterface form mixing flows?

craue commented 3 years ago

I also noticed this behavior. Try craue/CraueFormFlowDemoBundle@6eabdf4d96e744dd4568603c07ddd3652064905f.

bjjclimbing commented 3 years ago

Yes!!! that was de key! you have to confirm that the form you are working on is the same as on the flow your step is validating. Thanks a lot Christian!