I want to enable users to customize their platform, so that they can store the pieces of information they care about.
I have created these data types:
groupOfFields
-name
-description
-id
field
-label
-type
-groupID
value
-itemID
-textValue
-numberValue
-dateValue
I am generating a form for the users with the groupID that lists all the fields they created and corresponding inputs. To do this I am using a repeating to iterate through the list of fields and conditionally rendering the input type based on the field type. Because I am using a repeating group, I can’t access the values of the inputs inside the repeating group from event that occurs outside the repeating group.
The exception is in on the event When input changes. However, because the fields are custom, I don’t know what data type to expect, and so my value type has to have fields for all the accepted data types. Which means that I can’t use the information to from a single input of a single type to update form state of a value type.
Example:
The user creates a field of type number.
The form renders the input based on the type, that only accepts numbers.
When the input changes, the value returned is type number.
The workflow can not update the form state of value type, because they are not the same type.
This would be easier if I only had one field at a time, because I could have a form state for each base type, but I have a list of values to save at one time. So the problem of mapping the correct input values to each value instance’s correct field is the issue I can’t figure out.
How can I have a list of values of a dynamic type and stores those from users’ inputs?