show form input

This commit is contained in:
Alexander Foremny
2024-06-04 09:59:10 +02:00
parent 342ebdf61b
commit 9d3c32956b
3 changed files with 30 additions and 24 deletions

View File

@@ -53,8 +53,7 @@ mapValues get set (Form {view, fill}) =
}
runForm :: Form i o -> i -> View (Either i o)
runForm (Form {view}) i =
div_ [] $
(fmap Left <$> view i)
<> [ button_ [type_ "submit"] [text "submit"]
]
runForm form i =
form_ [onSubmit (either (\_ -> Left i) (Right) (form.fill i))] $
(fmap Left <$> form.view i)
<> [button_ [type_ "submit"] [text "submit"]]