Is there some builtin method for HTML text field completion with a simple <datalist>
in IHP? E.g. as in https://stackoverflow.com/a/19779010/69663
Asked
Active
Viewed 25 times
1

unhammer
- 4,306
- 2
- 39
- 52
1 Answers
3
Grepping the IHP code it seems not, but it was easy to just do it "manually":
instance View NewView where
html NewView { .. } = [hsx|
{renderForm thing}
<datalist id="languages">
{forEach languages renderOption}
</datalist>
|]
renderForm :: Thing -> Html
renderForm thing = formFor thing [hsx|
{(textField #language) { additionalAttributes = [("list", "languages")]}}
|]
renderOption :: Text -> Html
renderOption value = [hsx| <option value={value}/> |]

unhammer
- 4,306
- 2
- 39
- 52
-
Yes, there's no built-in way for doing this in IHP :) So this is the correct answer – Marc Scholten Aug 29 '22 at 13:31