MFlow  Create and maintain dynamic Web applications as easy and fast as console applications
Thou shall not write request handlers
 This release: 11/06/2014. (@agocorona) <>< . issues & bugs .  Mflow Source code,     source code of this site

Modal dialog

A modal dialog with a form enclosed. In this case, the modal dialog is inside a multi-step page flow. That means that in a single page it is possible to present complex interactions with the user with no need to use explicit javascript.

Running example

(in the light red box):

please enter your name

Source code:

{-# OPTIONS  -XCPP #-}
module Dialog (wdialog1) where

-- #define ALONE -- to execute it alone, uncomment this

#ifdef ALONE
import MFlow.Wai.Blaze.Html.All
main= runNavigation "" $ transientNav wdialog1
import MFlow.Wai.Blaze.Html.All hiding(retry, page)
import Menu

wdialog1= do
   page   wdialogw
   page  (wlink () << "out of the page flow, press here to go to the menu")

wdialogw= pageFlow "diag" $ do
   r <- p << "please enter your name" ++> getString (Just "your name") <** submitButton "ok"
   wdialog "({modal: true})" "Question"  $ 
           p << ("Do your name is \""++r++"\"?") ++> getBool True "yes" "no" <** submitButton "ok"

  `wcallback` \q -> if not q
                      then wdialogw
                      else  wlink () << b << "thanks, press here to exit from the page Flow"

comments powered by Disqus