Answer the question
In order to leave comments, you need to log in
Generate form from JSON?
I still don't quite understand if this can be done at all?
There is a large form that consists of input, select, switch
The client wants the presence of fields to be determined by JSON. And at the same time, each select sent separate requests.
I don't quite understand how this can be implemented.
That is, I receive a request, such as
"fields": {
"autombile": {
"brand": {
"label": "brand",
"name": "brand",
"dependence": "",
"type": "select"
"active": true
}
.
.
.
"name": {
"label": "name",
"name": "name",
"dependence": "",
"type": "input"
"active": true
},
"age": {
"label": "age",
"name": "age",
"dependence": "",
"type": "input"
"active": true
},
"switch": {
"label": "switch",
"name": "switch",
"dependence": "",
"type": "input"
"active": true
}
}
}
Answer the question
In order to leave comments, you need to log in
Here a lot depends on the architecture and api, but in addition to "fields" you can also receive "url".
"brand": {
"label": "brand",
"name": "brand",
"dependence": "",
"type": "select"
"active": true,
'items' => '/url/to/items/json?id=brand'
}
I don't see the difficulty. Write everything on different components, for each list item
https://jsfiddle.net/825x4bj3/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question