在 yesod 中使用 BootstrapHorizontalForm
use BootstrapHorizontalForm in yesod
我打算使用 BootstrapHorizontalForm,如何使用这个示例 guide,我的代码:
表格
churchForm :: Maybe Church -> AForm Handler (Church,Maybe FileInfo)
churchForm mc = (,) <$>
(Church
<$> areq textField (bfs MsgName) (churchName <$> mc)
<* bootstrapSubmit (BootstrapSubmit MsgCreateAction "btn-default" [("attribute-name","attribute-value")])
GET 方法
getChurchNewR :: Handler Html
getChurchNewR = do
(widget, enctype) <- generateFormPost $
renderBootstrap3 (BootstrapHorizontalForm (ColSm 0) (ColSm 4) (ColSm 0) (ColSm 6))
(churchForm Nothing)
defaultLayout $ do
msgAction = MsgCreateAction
actionR = ChurchNewR
mPath = Nothing
$(widgetFile "church/church")
但是有这个错误:
Handler/Church.hs:63:67: Not in scope: data constructor ‘ColSm’
谢谢你的帮助
这看起来像是缺少导入。检查您是否确实在文件顶部导入 CpmSm
。
此导入可以采用以下形式:
import Yesod.Form.Bootstrap3 (BootstrapGridOptions (ColSm))
或
import Yesod.Form.Bootstrap3 (BootstrapGridOptions (..))
甚至
import Yesod.Form.Bootstrap3
如果这听起来不熟悉,您可以查看 the modules chapter from Learn Yourself a Haskell 以了解有关导入的更多信息。
我打算使用 BootstrapHorizontalForm,如何使用这个示例 guide,我的代码:
表格
churchForm :: Maybe Church -> AForm Handler (Church,Maybe FileInfo)
churchForm mc = (,) <$>
(Church
<$> areq textField (bfs MsgName) (churchName <$> mc)
<* bootstrapSubmit (BootstrapSubmit MsgCreateAction "btn-default" [("attribute-name","attribute-value")])
GET 方法
getChurchNewR :: Handler Html
getChurchNewR = do
(widget, enctype) <- generateFormPost $
renderBootstrap3 (BootstrapHorizontalForm (ColSm 0) (ColSm 4) (ColSm 0) (ColSm 6))
(churchForm Nothing)
defaultLayout $ do
msgAction = MsgCreateAction
actionR = ChurchNewR
mPath = Nothing
$(widgetFile "church/church")
但是有这个错误:
Handler/Church.hs:63:67: Not in scope: data constructor ‘ColSm’
谢谢你的帮助
这看起来像是缺少导入。检查您是否确实在文件顶部导入 CpmSm
。
此导入可以采用以下形式:
import Yesod.Form.Bootstrap3 (BootstrapGridOptions (ColSm))
或
import Yesod.Form.Bootstrap3 (BootstrapGridOptions (..))
甚至
import Yesod.Form.Bootstrap3
如果这听起来不熟悉,您可以查看 the modules chapter from Learn Yourself a Haskell 以了解有关导入的更多信息。