formio.js
formio.js copied to clipboard
Custom component, children create duplicate key
Describe the bug When I drag a new custom component into the module and there is another one already inserted, the keys of the children are not updated but only of the parent causing duplicate keys for each component inserted
Version/Branch 5.3.0
To Reproduce Steps to reproduce the behavior:
- Create form
- Add multiple custom component
- show the json
- check the duplicate key
Expected behavior The same of the parent key, add a number based on how much component there are in a form
Screenshots First element json:
Second element json:
Additional context Code of custom component:
H2OIndirizzo: {
title: 'Indirizzo',
key: 'H2OIndirizzo',
icon: 'home',
schema: {
label: 'Indirizzo',
type: 'card',
key: 'h2o_indirizzo',
components: [{
label: 'Regione',
type: 'select',
key: 'regione',
input: true,
case: "uppercase",
validate: {
required: true
}
}, {
label: 'Provincia',
type: 'select',
key: 'provincia',
input: true,
case: "uppercase",
validate: {
required: true,
maxLength: 2
}
}, {
label: 'Comune',
type: 'select',
key: 'comune',
input: true,
validate: {
required: true
}
}, {
label: 'Indirizzo',
type: 'textfield',
key: 'indirizzo',
input: true,
validate: {
required: true
}
}, {
label: 'Numero civico',
type: 'textfield',
key: 'numerocivico',
input: true,
validate: {
required: true
}
}, {
label: 'CAP',
type: 'number',
key: 'cap',
input: true,
mask: false,
tableView: false,
delimiter: false,
requireDecimal: false,
inputFormat: "plain",
truncateMultipleSpaces: false,
validate: {
max: 99999,
required: true
}
}]
}
}
And I discovered that by changing the type of component in a card this problem does not happen