我正在努力构建一个html模板和反应形式结构,以根据用户选择的答案显示动态问题。并记录用户选择的答案。我将首先收到如下所示的API响应(当前,我仅显示最小的一组值)。
具有
下面有JSON数据
{
"mainCategoriesIdsList": [
120,
200
],
"categoriesList": [
{
"categoryName": "Wealth",
"categoryId": 120,
"initialFieldGroupIds": [
121
]
},
{
"categoryName": "Health",
"categoryId": 200,
"initialFieldGroupIds": [
121
]
}
],
"fieldGroupList": [
{
"groupId": 121,
"groupLabel": "How have you accumulated most of your wealth?",
"parentGroupId": 120,
"fieldListReferenceId": [
5000,7000
]
}
],
"fieldList": [
{
"fieldLabel": "Occupation",
"fieldDataType": "MULTI_SELECT",
"required": "Yes",
"parentMetaDataId": 121
}
],
"validValuesList": [
{
"validValueRefId": 5000,
"validValues": [
{
"valueId": 1008000,
"valueLabel": "Employment",
"valueDescription": "I earn/have earned income from an employer.",
"valueSequence": 1,
"dependantFieldGroupIds": [],
"dependantCategoryIds": [
200
]
},
{
"valueId": 1008001,
"valueLabel": "Self-Employment",
"valueDescription": "I earn/have earned income from doing business as a sole proprietor or independent contractor and only generate income for myself.",
"valueSequence": 2,
"dependantFieldGroupIds": [],
"dependantCategoryIds": []
}
]
}
]
}
用户选择的详细信息应保存如下
{
"userInput": [
{
"date": "",
"fieldId": "5000",
"inputResponse": "",
"valueIdList": [
"1008000","1008001"
]
}
]
}