haskell - How do I solve "HTTP request failed with: when is not a field" runtime errors in digestive-functors code? -
i have simple , incomplete happstack application, consists of digestive-functors form defined follows:
setrecformspec :: monad m => form text m reminder setrecformspec = reminder <$> "progname" .: string nothing <*> "channel" .: string nothing <*> "when" .: localtimeformlet "%d/%m/%y" "%h:%m" nothing <*> "recordlimit" .: stringread "can't parse number" (just 7)
and view defined follows:
setrecview :: view h.html -> h.html setrecview view = h.div ! a.class_ "container" $ h.h1 "set record reminder" childerrorlist "" view divformgroup $ label "progname" view "program name:" formcontrol $ inputtext "progname" view divformgroup $ label "channel" view "channel:" formcontrol $ inputtext "channel" view divformgroup $ label "when" view "when:" formcontrol $ inputdate "when" view divformgroup $ label "recordlimit" view "recording limit (days):" formcontrol $ inputtext "recordlimit" view divformgroup $ formcontrol $ inputsubmit "signup" -- divformgroup -- candidate go bootstrap library divformgroup :: h.html -> h.html divformgroup h = h.div ! a.class_ "form-group" $ h -- formcontrol -- candidate go bootstrap library formcontrol :: h.html -> h.html formcontrol h = (h ! a.class_ "form-control")
reminder defined follows:
data reminder = reminder { programname :: string -- ^ name of program , channel :: string -- ^ name of broadcast channel , firstshowing :: localtime -- ^ time of first showing , timerperioddays :: integer -- ^ how far in advance can set timer, in days } deriving (show)
when browse path form (/setrec) blank page following error message printed on console:
http request failed with: when not field
i've found error message defined (in https://github.com/jaspervdj/digestive-functors/blob/7e50d5686abc4b39389ed195693660d758987c7c/digestive-functors/src/text/digestive/form/internal.hs ) can't see there why 'when' field not found.
what problem here?
how debug kind of issue?
here's link whole code on github, in case need more @ code:
i ran same error when used utctimeformlet
, internally calls localtimeformlet
same error experienced.
take @ code of localtimeformlet
localtimeformlet dfmt tfmt d = localtime <$> "date" .: dateformlet dfmt (localday <$> d) <*> "time" .: timeformlet tfmt (localtimeofday <$> d)
as can see consists of 2 subformlets, reason why "when"
not field. refers overall construct "date"
, "time"
being actual fields.
the "solution" used skip function entirely since needed date, not precise time. if that's same in case want so, too.
otherwise have incorporate 2 fields view , should work.
Comments
Post a Comment