Reputation: 23714
I want to make an HTML form that actually uses the [form] tag in ELM. None of the example online do this -- they simply put the [input] tags in a [div] instead of a [form]
When I try switching my Elm app to a [form], my [input type=sumbit] tags don't seem to call back to Elm. The submit tries to leave the page and add a "?" to my url.
Any hints on how to do this?
WHY: I want to be a using [form], so I can use the "required" attribute on some [input] fields. This is just one part of my validation, but I like the UI that "required" tag presents.
Upvotes: 2
Views: 476
Reputation: 36030
You should use onSubmit
in Html.form
.
Here is the example.
Html.form [ onSubmit Submit ]
[ input
[ type' "submit"
, value "click here to submit"
]
[]
]
Upvotes: 2