- Issue created by @m0925j
- Status changed to Closed: won't fix
5 months ago 7:49am 21 August 2024 - 🇧🇪Belgium mschudders
That's not the purpose of datalist or a select element.
Only the options inside of the list should be allowed.
Now when you submit a value that is not in options, will get a error in core/lib/Drupal/core/Form/FormValidator. at performRequiredValidation method.
elseif (!isset($options[$elements['#value']])) {
$message_arguments['%choice'] = $elements['#value'];
$form_state->setError($elements, $this->t('The submitted value %choice in the %name element is not allowed.', $message_arguments));
$this->logger->error('The submitted value %choice in the %name element is not allowed.', $message_arguments);
}
Closed: won't fix
1.0
Code
That's not the purpose of datalist or a select element.
Only the options inside of the list should be allowed.