This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Dynamic forms in Elm. Load and save forms from/to JSON.
version 1.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2017-09-28 20:30:35 UTC
etaque/elm-form 3.0.0 <= v < 4.0.0 3.0.0
elm-lang/html 2.0.0 <= v < 3.0.0 2.0.0
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1
elm-community/elm-test 4.0.0 <= v < 5.0.0 4.2.0

README

Elm Dynamic Forms

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. Build Status

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/.

Features

  • 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.

Basic usage

See the example validation test suite and test helper function docs for how to test-drive validations.

-- TODO

JSON format

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"]
    }
}