Commit 3985ad3e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F7729SELECTAsDatalist' into 'master'

F7729 select as datalist

See merge request !121
parents a905a373 ffce6028
Pipeline #1651 passed with stage
in 2 minutes and 39 seconds
......@@ -3458,6 +3458,8 @@ Type: select
* *emptyItemAtEnd*: Existence of this item inserts an empty entry at the end of the selectlist.
* *emptyHide*: Existence of this item hides the empty entry. This is useful for e.g. Enums, which have an empty
entry and the empty value should not be an option to be selected.
* *datalist*: Similar to 'typeAhead'. Enables the user to select a predefined option (sql1, itemList) or supply any
free text. Attention: Safari (and some other) browsers do not support this fully - https://caniuse.com/#search=datalist.
.. _`subrecord-option`:
......
......@@ -2448,9 +2448,17 @@ abstract class AbstractBuildForm {
$formElement = HelperFormElement::prepareExtraButton($formElement, false);
$attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
$html = '<select ' . $attribute . '>' . $option . '</select>';
if (isset($formElement["datalist"])) {
if ($formElement[FE_DYNAMIC_UPDATE] === 'yes') {
throw new UserFormException("Datalist funktionert nicht mit dynamic update", ERROR_NOT_IMPLEMENTED);
}
$datalistId = $formElement[FE_HTML_ID] . '-datalist';
$html = '<input ' . Support::doAttribute('list', $datalistId) . $attribute . '><datalist '
. Support::doAttribute('id', $datalistId) . '>' . $option . '</datalist>';
} else {
$html = '<select ' . $attribute . '>' . $option . '</select>';
}
$html = $html . $this->getHelpBlock() . $formElement[FE_TMP_EXTRA_BUTTON_HTML];
return $html . $formElement[FE_INPUT_EXTRA_BUTTON_INFO];
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment