Create view element for input
, which is a single line text input,
in contrast with a textarea
, which is a text box.
Use a similar API for the Input
module as is used in Textarea
.
The HTML can look like this:
div [ class "form-element" ]
[ label [ class "label" ]
[ span [ class "label-text" ] [ text "Label" ]
, Html.input
[ class "input"
, classList [ ( "error", True ) ]
, value "Some text"
, onInput msg
]
[]
,
div [ role "alert", ariaLive "assertive" ]
[ p [ class "error-message" ] [ text "Error message" ] ]
]
]
The endpoint for POST-ing a comment also supports a "username"
field,
which is a string.
Make the username, and the comment text, a form, using the way to make forms from this repo. You can check out the tags in that repo to see a progression of how the form is built.