Dynamic Forms
Dynamic forms based on configuration refer to the ability to create and customize forms dynamically by using configuration files or settings, rather than hardcoding the form structure in the source code. This approach allows for more flexibility and easier maintenance of forms, especially in situations where form requirements may change frequently.
Nested Forms
In some cases, there is a need to have several field sets or field groups. Particularly on the KYC form definition, there is a need to have one or more groups. If you take a look into VerifyDataInputType, you'll notice a few properties: person details, address, driver's license, and passport...
E.g. When a user goes through the KYC process, he will provide a driver's license or passport.
The FieldSetType
allows you to specify a set of rules for the field sets:
{
"kycFieldsConfig": [
{
"description": null,
"group": "Person Details",
"groupPolicy": "AllRequired",
"label": "Personal Details",
"name": "personDetails",
"fields": [],
"__typename": "FieldSetType"
},
{
"description": null,
"group": "Document",
"groupPolicy": "OneRequired",
"label": "Driver Licence",
"name": "driverLicence",
"fields": [],
"__typename": "FieldSetType"
},
{
"description": null,
"group": "Address",
"groupPolicy": "AllRequired",
"label": "Address",
"name": "address",
"fields": [],
"__typename": "FieldSetType"
},
{
"description": null,
"group": "Document",
"groupPolicy": "OneRequired",
"label": "Passport",
"name": "passport",
"fields": [],
"__typename": "FieldSetType"
},
{
"description": null,
"group": "Document",
"groupPolicy": "OneRequired",
"label": "Medicare",
"name": "medicare",
"fields": [],
"__typename": "FieldSetType"
},
{
"description": null,
"group": "Approve and Verify",
"groupPolicy": "OneRequired",
"label": "Approve and Verify",
"name": "consents",
"fields": [],
"__typename": "FieldSetType"
}
]
}
For the FieldSetType most important properties beside fields for form definition are group and group policy. Group policy defines validation policy for the groups with the same name. In the example above:
- AllRequired
- OneRequired
- NoneRequired
All fieldsets with this group name are required. There will be only one group with this policy.
{ group: "Person Details", groupPolicy: "AllRequired" }
One field set from this group is required, which means passport or driver's license.
{ group: "Document", groupPolicy: "OneRequired" }
This would define an optional set of details.
{ group: "Some", groupPolicy: "NoneRequired" }
Flat Forms
The FieldConfigType
specifies validation rules for the fields.
This configs are provided on:
public.fieldsConfig
query and- as part of
userQueries.kycFieldsConfig