I have a list of languages, and with a combobox I can see the codes :
@select(
searchForm("langCode"),
options(for (lang <- langs) yield (lang.langCode)),
'_default -> "--- Choose a Language ---",
'_label -> "Language"
)
And now i want use a datalist HTML to autocomplete a text area with the codes. I have tried with this but it doesn't get the @lang.langCode value:
@inputText(searchForm("langCode"), '_label -> "Language")
<datalist id=langCode>
@langs.map { lang =>
<option>
@lang.langCode
</option>
}
</datalist>
Thank you.
Your code is mostly correct, except:
Add list
attribute to @inputText
arguments:
@inputText(searchForm("langCode"), '_label -> "Language", 'list -> "langCodeDatalist")
Make sure id
used for datalist
is different from the one used for the input box:
< datalist id="langCodeDatalist">
Once I made these changes, it worked. Check the source code to make sure @lang.langCode
is getting pasted correctly.