Just keep adding objects into the array - as long as the name
is the same, it seems to combine it.
Working Demo: https://stackblitz.com/edit/react-conversational-form-with-radio
this.formFields = [
{
'tag': 'input',
'type': 'radio',
'name': 'country',
'cf-questions': 'What is your country?',
'cf-label': 'ukraine',
'value': 'ukraine',
},
{
'tag': 'input',
'type': 'radio',
'name': 'country',
'cf-label': 'india',
'value': 'india',
},
{
'tag': 'input',
'type': 'radio',
'name': 'country',
'cf-label': 'sri lanka',
'value': 'sri lanka',
},
{
'tag': 'input',
'type': 'text',
'name': 'lastname',
'cf-questions': 'What is your lastname?'
}
];
Returns the form result something like this:
{ country: ["ukraine"], lastname: 'tasdasd' }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.