Yesod Mform and hamlet -


hi new yesod , following documentation make form. in documentation form template created in .hs file itself. have separate hamlet want customize.

i want access "fields" in hamlet file. expected type of 'generateformpost' (xml, enctype) . can tell me should returning 'tablemform extra' . think should in xml format. think should not using towidget in below example of documentation.

tablemform =     fields <- form lis (\(w,h) -> mopt intfield "this not used" (just h) )     return (fields)      ---i know line has type error. can suggest how deal  {-   --i referring code yesod website make form. in using runformget, want use generateformpost , creating widget used in displaying website. don't want create widget here in hamlet file 'fields' accessed via interpolation.  personform :: html -> mform handler (formresult person, widget) personform =     (nameres, nameview) <- mreq textfield "this not used" nothing     (ageres, ageview) <- mreq intfield "neither this" nothing     let personres = person <$> nameres <*> ageres     let widget =             towidget                 [lucius|                     ##{fvid ageview} {                         width: 3em;                     }                 |]             [whamlet|                 #{extra}                 <p>                     hello, name #                     ^{fvinput nameview}                     \ , #                     ^{fvinput ageview}                     \ years old. #                     <input type=submit value="introduce myself">             |]     return (personres, widget)  -}  gethomer :: handler html gethomer = defaultlayout $     -- generate form displayed     (fields, enctype) <- generateformpost tablemform     let (fires,fiview) = unzip fields     $(widgetfile "layout")                |] 

please let me know if there misunderstanding. have idea of how form way done in documentation, want use separate hamlet file, want customize of form.

thanks sai

edit: sorry, wasn't clear. trying make mform instead of creating layout of form in ".hs" file , wanted give layout in hamlet file. have done through http://pastebin.com/fwpzskxy . after doing split in 2 files wanted. have solved errors. anyways

i got it. not clear of "tablemform extra" has return. know has return of type [(formresult a, xml)][1] . not sure type of "form lis ((w,h) -> mopt intfield (fromstring w) (just h) )" -- line 2 , followed done in documentation did in way done there.(without use of external widget file) .

after doing tried in way wanted i.e using separate hamlet, julius , lucius files. http://pastebin.com/fggph2cu . worked !!

in summary wasn't clear of 'type' of "form lis ((w,h) -> mopt intfield (fromstring w) (just h) )" . once figured out, easy.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -