Active
Project:
Tagify
Version:
1.2.50
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Mar 2026 at 12:39 UTC
Updated:
28 Apr 2026 at 14:50 UTC
Jump to comment: Most recent
When using the render element (select_tagify) in a custom form, and specifying '#multiple' => TRUE, the user cannot select multiple values.
Create a custom form with the following build() :
public function buildForm(array $form, FormStateInterface $form_state): array {
$values = $form_state->getValue('select') ?? [];
$form['select'] = [
'#type' => 'select_tagify',
'#multiple' => TRUE,
'#title' => 'Items',
'#options' => [
1 => 'A',
2 => 'B',
3 => 'C',
],
'#default_value' => $values,
'#attributes' => [
'class' => ['foo'],
],
'#identifier' => 'foo',
];
$form['actions'] = [
'btn-submit' => [
'#type' => 'submit',
'#value' => 'Submit',
],
];
return $form;
}
Then try to select multiple items.
Comments
Comment #2
joelwinzer commentedThere's a quick workaround. You need to set #mode to an empty string, and then it will work:
$form['form_element']['#type'] = 'select_tagify';
$form['form_element']['#mode'] = '';