haskellyesodyesod-forms

How to get user input in Yesod without using Yesod Form


In my page I have a search field(text area).

Yesod Form is quite complicated to use, so I figure I'll just use Javascript to get the value typed by the user. But then how my Haskell program gets that value?


Solution

  • You need to make a HTTP request to the server and pass it data.

    In case of GET request, you just declare handler parameters in config/routes and then get them as getYourHandlerR arguments. In case of POST, you can use requireJsonBody to get data as JSON or getPostParams.