Search code examples
jqueryformsyesod

Yesod and dynamic Bootstrap/jQuery form


I work with an existing form built with Bootstrap. But this form contains <input>s dynamically added with jQuery. So user can add any number of inputs before submitting the form.

I know that the names of these inputs forms like attr1, attr2, attr3 and so on. But I cannot run it like this:

event <- runInputPost $ NewEvent <$> iopt textField "attr1"
                                 <*> iopt textField "attr2"
                                 <*> iopt textField "attr3"

because these inputs created dynamically. So I need extract, well, some list of these textFields from the form. Is it possible? I never worked with dynamic forms, so I need any help.


Solution

  • The function you're looking for is runRequestBody: http://www.stackage.org/haddock/lts-2.7/yesod-core-1.4.9.1/Yesod-Core-Handler.html#v:runRequestBody