Alpaca provides the easiest way to generate interactive HTML5 forms for web and mobile applications. It uses JSON Schema and simple Handlebars templates to generate great looking, dynamic user interfaces on top of Twitter Bootstrap, jQuery UI, jQuery Mobile and HTML5.
I'm updating a form, trying to get conditional dependencies working, within sub arrays/containers. Is this possible in Alpaca?
Any advice would be much appreciated.
I'm updating a form, trying to get conditional dependencies working, within sub arrays/containers. Is this possible in Alpaca? Any advice would be much appreciated.
Here's a JSFiddle and below is my example code. I only want the Hospital (other) to show if the option hospital/320789 is chosen.
$(".field").alpaca({ "schema": { "type": "object", "title": "Test Form with conditionals in containers", "required": [], "properties": { "~0": { "type": "object", "properties": { "~1": { "type": "object", "properties": { "hfrsHDC": { "id": "conditionalTest", "type": "string", "title": "Please select an option", "options": [{ "value": 320789, "id": "hospital" }, { "value": 320790, "id": "community" } ], "enum": [ "320789", "320790" ] } } }, "~8": { "type": "object", "title": "Hospital details", "required": [], "properties": { "hospitalOther": { "type": "string", "title": "Hospital (Other)" }, } } } } } }, "options": { "fields": { "~0": { "fields": { "~8": { "fields": { "hospitalOther": { "dependencies": { //"#conditionalTest": [320789] "~0_~1_hfrsHDC": [320789] } }, //"dependencies": { // "#conditionalTest": "320789" // } } } } } }, } });