我有一个已经存在的使用Bootstrap构建的表单。此表单不仅包含input
项,还包含<select>
项(它是颜色列表):
<form .form-horizontal
#addEventForm
role=form
method=post
action=@{AddEventAtDateR currentDate}>
...
<label for=diaryEventBackgroundColor
.col-sm-4
.control-label>
_{MsgEventColor}
<div .col-sm-7>
<select .form-control #color>
<option value=grey selected>
_{MsgBackgroundColorGrey}
<option value=red>
_{MsgBackgroundColorRed}
<option value=orange>
_{MsgBackgroundColorOrange}
...
这是我的代码:
event <- runInputPost $ NewEvent <$> ireq textField "title"
<*> iopt textareaField "description"
<*> ireq timeFieldTypeTime "beginTime"
<*> ireq dayField "beginDate"
<*> ireq (selectField ?) "color"
如何从<select>
项目“颜色”中提取值?在所有示例中(在Yesod Book中),我只在selectField
s中看到AForm
。