mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-06 14:26:35 +03:00
Add hidden field helper.
This commit is contained in:
parent
ed814e54ee
commit
ca469f39ce
25
src/Form.elm
25
src/Form.elm
@ -205,6 +205,31 @@ text name toHtmlFn =
|
||||
}
|
||||
|
||||
|
||||
hidden :
|
||||
String
|
||||
-> String
|
||||
-> (List (Html.Attribute Never) -> view)
|
||||
-> Field String view
|
||||
hidden name value toHtmlFn =
|
||||
Field
|
||||
{ name = name
|
||||
, initialValue = Nothing
|
||||
, type_ = "hidden"
|
||||
, required = False
|
||||
|
||||
-- TODO shouldn't be possible to include any server-side validations on hidden fields
|
||||
, serverValidation = \_ -> DataSource.succeed []
|
||||
, toHtml =
|
||||
\fieldInfo info ->
|
||||
-- TODO shouldn't be possible to add any validations or chain anything
|
||||
toHtmlFn (toInputRecord name Nothing info fieldInfo |> .toInput)
|
||||
|
||||
-- TODO should it be Err if Nothing?
|
||||
, decode = Maybe.withDefault ""
|
||||
, properties = []
|
||||
}
|
||||
|
||||
|
||||
radio :
|
||||
String
|
||||
-> ( ( String, item ), List ( String, item ) )
|
||||
|
Loading…
Reference in New Issue
Block a user