agocorona / MFlow

(Haskell) Web application server with stateful, type safe user interactions and widget combinators
http://mflowdemo.herokuapp.com
Other
100 stars 12 forks source link

runSecureNavigation fails with submitButton widget #67

Open nickgeoca opened 8 years ago

nickgeoca commented 8 years ago

Description: runSecureNavigation appears to fail with submitButton widget. Behavior is after submiting data, one expects next page to load, but repeats the same page with submitButton. It has behaved differently before in that it goes to next page, but then goes back to submitButton page when user tries to go forward. Line: haskell <** submitButton "Submit" Version:

{-# LANGUAGE OverloadedStrings #-}

module Main
where
import MFlow.Wai.Blaze.Html.All hiding(main)
import qualified MFlow.Forms as F
import Data.Typeable
import System.IO.Unsafe

sitePages :: FlowM Html IO ()
sitePages = do 
  page $ wlink () << b "Here A"
  page $ wlink () << b "Here B"
  someVal <- page  
    $   getString Nothing <! hint "Test" 
    <++ br
    <** submitButton "Submit"
  page $ wlink () << b "Here 1"
  page $ wlink () << b "Here 2"
  where
  hint x = [("placeholder", x)]

main :: IO ()
main = do 
  setAdminUser ("admin"::String) (""::String)
  runSecureNavigation "" . transientNav $ do
      sitePages