Hi @sdirix
What I want to achieve is, that users can create items and packages in the same form, and for each item select the package the item is packed to from a dropdown.
While this works (the dropdown is properly populated with the name of each package dynamically), I am stuck with the fact, that when I select a value of a package that is created during the same form editing process, the field shows an evaluation error for the enum.
Situation
I have the following situation in my vue-vanilla form:
- I have another array controller to collect “boxes”-objects
- I have an array controller to collect “items”-objects
- In every item, I have an enum dropdown where users should select one of the items from the boxes array by it’s name field
- I have a jsonforms component that receives it’s schema from a component data object (reactive)
Approach
- create the form schema with an item array and an enum item property “package”
- define a single default enum value “Unpacked” for the package property of the item
- load original schema into my component data “schema”
- load form data into my component data “formData”
- place jsonform component into template of my component, modelling its schema to my component data “schema”, and modelling its data to “formData”
- add a watcher for “formData” to update “schema” by adding enum values for each package item in the data
Expectation
- change in “schema” triggers the dispatch function and updates the jsonforms controller with the new schema
- dropdown is updated with all package item values
- form can be submitted with any value from the dropdown
Observations
- default value can always be selected and the form saved
- when creating package items in the form, their respective entry is added to the dropdown to be selected
- when selected, the field shows an error “must be equal to one of the allowed values”, even though in the Vue Inspector, the data provided in jsonforms.core.errors suggests, that the data entered is in fact an allowed value …
Unfortunately, this causes the form to be invalid, so I cannot save it. Any idea what’s happening here?