Add type="time" to timeField

This commit is contained in:
Maximilian Tagher 2014-11-24 14:40:11 -05:00
parent 4ee1eb17cd
commit 1944f02c84
2 changed files with 3 additions and 2 deletions

View File

@ -160,7 +160,7 @@ timeField = Field
{ fieldParse = parseHelper parseTime { fieldParse = parseHelper parseTime
, fieldView = \theId name attrs val isReq -> toWidget [hamlet| , fieldView = \theId name attrs val isReq -> toWidget [hamlet|
$newline never $newline never
<input id="#{theId}" name="#{name}" *{attrs} :isReq:required="" value="#{showVal val}"> <input id="#{theId}" name="#{name}" *{attrs} type="time" :isReq:required="" value="#{showVal val}">
|] |]
, fieldEnctype = UrlEncoded , fieldEnctype = UrlEncoded
} }

View File

@ -26,7 +26,7 @@ mkYesod "HelloForms" [parseRoutes|
/file FileR GET POST /file FileR GET POST
|] |]
myForm = fixType $ runFormGet $ renderDivs $ pure (,,,,,,,,,,,) myForm = fixType $ runFormGet $ renderDivs $ pure (,,,,,,,,,,,,)
<*> pure "pure works!" <*> pure "pure works!"
<*> areq boolField "Bool field" Nothing <*> areq boolField "Bool field" Nothing
<*> aopt boolField "Opt bool field" Nothing <*> aopt boolField "Opt bool field" Nothing
@ -39,6 +39,7 @@ myForm = fixType $ runFormGet $ renderDivs $ pure (,,,,,,,,,,,)
<*> aopt (radioFieldList fruits) "Opt radio" Nothing <*> aopt (radioFieldList fruits) "Opt radio" Nothing
<*> aopt multiEmailField "Opt multi email" Nothing <*> aopt multiEmailField "Opt multi email" Nothing
<*> areq nicHtmlField "NIC HTML" Nothing <*> areq nicHtmlField "NIC HTML" Nothing
<*> aopt timeField "Opt Time" Nothing
instance Show Html where instance Show Html where
show = renderHtml show = renderHtml