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@gmail.com (@agocorona) <>< . issues & bugs .  Mflow Source code,     source code of this site




Radio box

Show how radio buttons are programmed in MFlow. 

In this  case,  unlike setRadio, setRadioActive inmediately return the value.


Running example

(in the light red box):

Radio buttons

redgreenblue


Source code:

{-# OPTIONS  -XCPP #-}
module Radio ( radio) where

-- #define ALONE -- to execute it alone, uncomment this
#ifdef ALONE
import MFlow.Wai.Blaze.Html.All
main= runNavigation "" $ transientNav grid
#else
import MFlow.Wai.Blaze.Html.All hiding(retry, page)
import Menu
#endif

radio = do
   r <- page $   p << b <<  "Radio buttons"
            ++> getRadio [\n -> fromStr v ++> setRadioActive v n | v <- ["red","green","blue"]]

   page $ p << ( show r ++ " selected")  ++> wlink ()  << p <<  " menu"

-- to run it alone, change page by ask and uncomment this:
--main= runNavigation "" $ transientNav radio

comments powered by Disqus