Yesod form with multiple buttons

ε祈祈猫儿з 提交于 2019-12-05 13:20:26

You can just use the Input form functions to get the raw values, and explicitly set a name attribute on the various buttons. Something like this in the HTML:

<input type="submit" name="preview" value="Preview">

And in the Haskell code:

res <- runFormPost ...
isPreview <- runInputPost $ iopt boolField "preview"
if isPreview then ... else ...

Sorry if this doesn't typecheck, I don't have my normal development system right now. But I think this is the right general approach.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!