-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with test submitForm with LiveCollectionType #2512
Comments
Error reproduced here |
If we put InteractWithLiveComponentTrait aside (where there may be something to fix)... does your component work ? In your reproducer I notice you're using Collection as type hint for "participants", and reset formData everytime the form is instanciated |
Hi, Yes it does work, in my application I process and store the data and everything is properly stored in dB if data is correct. When the data is not, the form is properly displayed with all the submitted and the error. |
I think here you cannot submit directly with collection items, but need to first make the same call that livecollection make, in order to create the fields in the form. $component->call('addCollectionItem', ['name' => 'event_creation']); |
Thanks a lot, it indeed solves the problem, just the way to call it is like this: $component->call('addCollectionItem', ['name' => 'participants']); where |
Is there a documentation update that could be done to help on this? |
Maybe in the LiveCollection part ? Or a code example after the big test one at the very end of the page ? This could be a good idea, yeah 👍 |
@smnandre I'll make a proposal pull request |
Thank you very much! 🤝 i'll have a look later tonight |
Hi,
I'm struggling to use the submitForm helper with a form containing a LiveCollectionType.
This is the setup.
EventCreationTyp is the following:
So in my test, I want to submit the following:
And my issue is that I get a form validation error for the
participants
saying that for the 1st item in the participants, thename
should not be empty and for the second theemail
should be not null...When I debug and look what is existing as
$formValues
at the save time in my LiveComponent I get the following:this debug is done at the start of the save function in my LiveComponent
in each of the Collection Item, only the last key=>value has been kept... I've tried to debug but can't see where these values are trimmed down. Am I doing something off?
The text was updated successfully, but these errors were encountered: