title: Yesod Mform and hamlet
body: <p>Hi I am new to yesod and following the documentation to make a form. In the documentation the form template was created in .hs file itself. But I have a separate hamlet where I want to customize.</p>
  
  <p>I want to access "fields" in my hamlet file. The expected type of 'generateFormPost' is (xml, Enctype) . Can anybody tell me what I should be returning from 'tableMform extra' . I think it should be in xml format. But I think I should not be using toWidget as in below example of documentation.</p>
  
  <pre><code>tableMform extra = do
      fields &lt;- forM lis (\(w,h) -&gt; mopt intField "this is not used" (Just h) )
      return (fields)      ---I know this line has the type error. Can anybody suggest how to deal with it
  
  {-  
  --I am referring this code from yesod website to make my form. In this it was using runFormGet, but I want use generateFormPost and moreover it was creating a widget which is used in displaying the website. I don't want to create the widget here but in my hamlet file where the 'fields' is accessed via interpolation.
  
  personForm :: Html -&gt; MForm Handler (FormResult Person, Widget)
  personForm extra = do
      (nameRes, nameView) &lt;- mreq textField "this is not used" Nothing
      (ageRes, ageView) &lt;- mreq intField "neither is this" Nothing
      let personRes = Person &lt;$&gt; nameRes &lt;*&gt; ageRes
      let widget = do
              toWidget
                  [lucius|
                      ##{fvId ageView} {
                          width: 3em;
                      }
                  |]
              [whamlet|
                  #{extra}
                  &lt;p&gt;
                      Hello, my name is #
                      ^{fvInput nameView}
                      \ and I am #
                      ^{fvInput ageView}
                      \ years old. #
                      &lt;input type=submit value="Introduce myself"&gt;
              |]
      return (personRes, widget)
  
  -}
  
  getHomeR :: Handler Html
  getHomeR = defaultLayout $ do
      -- Generate the form to be displayed
      (fields, enctype) &lt;- generateFormPost tableMform
      let (fires,fiview) = unzip fields
      $(widgetFile "layout")       
          |]
  </code></pre>
  
  <p>Please let me know if there is any misunderstanding. I have idea of how to get the form from the way done in the documentation, but I want to use a separate hamlet file, as I want to customize the look of the form.</p>
  
  <p>Thanks
  Sai</p>
  
  <p>EDIT:
  Sorry, I wasn't clear. I was trying to make a Mform where instead of creating the layout of the form in the ".hs" file , I wanted to give the layout in hamlet file. I have done it through <a href="http://pastebin.com/fwpZsKXy" rel="nofollow">http://pastebin.com/fwpZsKXy</a> . But after doing that I could split it in to two files as I wanted.  I have solved those errors. Thanks anyways</p>