Generate validating forms from JSON schemas.
The form state.
Form messages for update.
Initialize a form state with options and a schema. Use json-tools/json-schema to parse or build a schema.
Update the form state.
The form fields as HTML. Use together with submit to submit the form.
Triggers the form to be submitted for validation.
form [ onSubmit Json.Schema.Form.submit ]
[ Json.Schema.Form.view state
, button [] [ text "Submit" ]
]Get the output value of the form if it validates.
case Json.Schema.Form.getOutput state of
Just value ->
-- The `value` is a tree of all the fields in the form (see the
-- `Json.Schema.Form.Value` module).
-- Use the `Json.Schema.Form.Encode.encode` function to turn
-- it into a JSON value.
Nothing ->
-- If any field in the form is not valid `getOutput` will
-- return `Nothing`.
Customize the generated form.
errors- A function that turns error values into user readable strings.formats- A list of custom formats (seeJson.Schema.Form.Format).