kelp404 / angular-form-builder

Drag and drop to build bootstrap forms in AngularJS.
http://kelp404.github.io/angular-form-builder/
MIT License
600 stars 340 forks source link

Creating conditional fields #98

Closed DGarvanski closed 8 years ago

DGarvanski commented 8 years ago

Currently, an example for the form in the DB would be this:

{
    "_id": ObjectID("5787ae2e86cfd9f7185ae3ab"),
    "acknAll": false,
    "name": "Service One",
    "description": "Service One Desc",
    "form": [
        {
            "id": 1,
            "component": "textInput",
            "editable": true,
            "index": 0,
            "label": "Text Input",
            "description": "description",
            "placeholder": "placeholder",
            "options": [],
            "required": false,
            "validation": "/.*/"
        },
        {
            "id": 2,
            "component": "textInput",
            "editable": true,
            "index": 1,
            "label": "Text Input",
            "description": "description",
            "placeholder": "placeholder",
            "options": [],
            "required": false,
            "validation": "/.*/"
        },
        {
            "id": 0,
            "component": "textInput",
            "editable": true,
            "index": 2,
            "label": "Text Input",
            "description": "description",
            "placeholder": "placeholder",
            "options": [],
            "required": false,
            "validation": "/.*/"
        }
    ],
    "id": "5787ae2e86cfd9f7185ae3ab"
}

Is it possible to add conditions? For example - form object with id: 2 only visible if the value for form object with id: 0 is "Some Value." Is it something already supported or is there a way to do it?