- Issue created by @hmdnawaz
If you use a nested multivalue field, and you click on add another item
of the nested field, it adds two fields instead of one.
Add a nested multivalue field and click on add another item
of the nested field. Here is the example code.
$form['contact_information'] = [
'#type' => 'multivalue',
'#title' => $this->t('Contact information),
'#cardinality' => MultiValue::CARDINALITY_UNLIMITED,
'#default_value' => $this->config->get('contact_information') ?? [],
'mail' => [
'#type' => 'multivalue',
'#title' => $this->t('E-Mail'),
'#cardinality' => MultiValue::CARDINALITY_UNLIMITED,
'email_address' => [
'#type' => 'email',
'#title' => $this->t('E-mail address),
],
],
'website' => [
'#type' => 'url',
'#title' => $this->t('Website'),
],
];
Here if you click on the Add another item
of the mail field, it adds two more mail fields. While it should add one mail field only.
The nested multivalue field should work fine and it should add a single field on clicking the Add another item
Active
1.0
Code