You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question regarding: Classically implemented embedded collection of forms inside a Live Component with ComponentWithFormTrait results in javascript console error "Invalid model name" after dynamically adding entries via javascript in the frontend.
#1973
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.
I'm sorry if this is a silly question or this is not the right place to ask it...
The situation:
I have a live component using the ComponentWithFormTrait.
In the entity of the form i have a OneToMany relation.
In the formtype of the form i have a normal CollectionType field with 'allow_add' => true and 'allow_delete' => true.
The handling of the CollectionType field is implemented "classically" like described in https://symfony.com/doc/current/form/form_collections.html.
In the frontend the user can click a add button and some javascript code uses the vars.prototype information to add new entries to the collection.
The problem:
When i add a new entry in the frontend and i enter something in the fields of the new entry and trigger a focus change,
then the javascript code of the livecomponent throws an error to the browser console:
Uncaught Error: Invalid model name "akte_tab_kunde.kunde.0.kontakte.kontakte.0.kontaktart"
So, the Livecomponent part seems to have a problem with fields that are added by custom javascript and that it doesn't know about.
The error is thrown here:
The question:
I know that there is a special LiveCollectionType that can be used here.
I would like to know if using a normal CollectionType here is not supported or if i am just missing something to make it work?
Perhaps there is a way to update the model after adding a entry?
Or a way to just exclude the CollectionType field form being handled/validated by the Live Component?
The text was updated successfully, but these errors were encountered: