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




Autocomplete widget

enter red green or blue and see a hint list below the input box



Running example

(in the light red box):

Autocomplete

when submit is pressed, the box value is returned



Source code:

{-# OPTIONS -XCPP #-} 
module AutoComplete ( autocomplete1) where
import Data.List

-- #define ALONE
#ifdef ALONE
import MFlow.Wai.Blaze.Html.All
main= runNavigation "" $ transientNav autocomplete1
#else
import MFlow.Wai.Blaze.Html.All hiding(page)
import Menu
#endif

autocomplete1= do
   r <- page $   pageFlow "auto"
             $   p <<  "Autocomplete "
             ++> p <<  "when submit is pressed, the box value  is returned"
             ++> wautocomplete Nothing filter1 <! hint "red, green or blue"
             <** submitButton "submit"
   page  $ p << (show r ++ " selected")  ++> wlink () (p <<  " menu")

   where
   filter1 s = return $ filter (isPrefixOf s)
                        ["red","red rose","green","green grass","blue","blues"]

hint s= [("placeholder",s)]


comments powered by Disqus