foxhound87 / mobx-react-form

Reactive MobX Form State Management
https://foxhound87.github.io/mobx-react-form
MIT License
1.09k stars 129 forks source link

Adding a setof nested field to an array field #504

Closed Leapfrognz closed 1 year ago

Leapfrognz commented 5 years ago

Hi there, we are building a rather large app with multiple forms. We are having difficulty adding a set of new nested fields to an array. I have noticed comments in other issues stating that this is tricky with unified fields, but not impossible? It seems whenever I use a bracket in a field name, I get errors when validating the field - Invalid field instance. Is there an example using unified field setup and adding new fields?

foxhound87 commented 5 years ago

please provide a codesandbox, I will provide an example using the mixed mode for fields definition.

foxhound87 commented 5 years ago

@Leapfrognz This is a mixed-mode example: https://codesandbox.io/s/mixed-mode-sctb3

It is still not in documentation because needs some fixes (in this example we need to use update() to create the nested fields, but not for all cases).

See also: https://github.com/foxhound87/mobx-react-form/blob/master/tests/data/forms/fixes/form.q1.js