Open DanielCollins opened 9 years ago
I came across the exactly problem as yours, here 's my solution:
import Text.Digestive.Types
import Text.Digestive.View
...
lform <- getForm "profile" (profileForm u')
let lform' = lform {viewInput = [
(toPath "email", TextInput $ sUserEmail user)
, (toPath "desc", TextInput $ sUserDesc user)
]}
...
Not nice but do solve the problem, we should providing a helper to do this kind of things, for example, set some pre-defined values in views.
thanks @winterland1989 this is workable
@jaspervdj Do you think we should add some APIs to poke around view?
Yes, I wouldn't mind having an API which allows you to set these values in a more convenient way.
after using
postForm
, if there are form errors, i get aview
value. I cannot work out how to reset some of the form values held in the view before re-displaying the form. Specifically, my captcha should be regenerated with each request so as to prevent unlimited captcha attempts.