An action is a flow attached to a widget that is executed when the widget is validated. The action receives the widget value as input. The action take control of the navigation. When the action finalizes, the flow return to the page where the widget was inserted and will return the value. If there is more than one validated widget with actions, the actions are called in sequence.
Here two widgets with two actions are called in sequence.
Two boxes with one action each one
module Actions (actions) where
import MFlow.Wai.Blaze.Html.All hiding(page)
actions = do
r<- page $ p << b << "Two boxes with one action each one"
++> getString (Just "widget1") `waction` action
<+> getString (Just "widget2") `waction` action
<** submitButton "submit"
page $ p << ( show r ++ " returned") ++> wlink () << p << " menu"
action n= page $ getString (Just $ n ++ " action")<** submitButton "submit action"
-- to run it alone, change page by ask and uncomment this:
--main= runNavigation "" $ transientNav actions