Implement forms that are generated server-side from JSON data. This is useful to integrate your Elm frontend with models and forms generated by the backend.
Install Elm Dynamic Forms
elm package install fabiommendes/elm-dynamic-forms
This package was create to interop with Django. If that is also your use case, please check the sister project https://github.com/fabiommendes/django-dynamic-forms/.
- Leverages elm-form library to perform validation and representation of form values.
- Conversion of complete form data from/to JSON.
- Read and serialize form content to JSON to easily interop with the backend.
See the example validation test suite and test helper function docs for how to test-drive validations.
-- TODO
Dynamic forms defines a simple JSON format for serialization of form declarations.
{
"action": "/foo/bar",
"fields": {
"name": {
"type": "string",
"label": "Name",
"placeholder": "Full name",
"help": "Your name and family name in the order you'd like to be called.",
"validators": [["max-length", 200]],
},
"age": {
"type": "integer",
"label": "Age",
"help": "Your age",
"validators": [["min-value", 0], ["max-value", 120]],
}
},
"data": {
"name": "R2D2"
},
"layout": {
"type": "linear",
"fields": ["name", "age"]
}
}