json - Loading a select box options on the basis of other select box using jsonSchema -


i'm using jsonschema generate our forms , validate these.

below sample json:

{   "title": "microsoft account request",   "readonly": false,   "$schema": "http://json-schema.org/draft-04/hyper-schema",   "description": "microsoft azure account request product specification",   "properties": {     "product": {       "title": "product",       "databinding": {"references": ["spec_id#/properties/service"]},       "properties": {         "offers": {           "title": "product offers",           "propertyorder": 1,           "type": "array",           "uniqueitems": true,           "format": "tabs",           "items": {             "title":"product offer",             "properties": {               "category": {                 "title": "category",                 "readonly": false,                 "unique":true,                 "strictproperties": true,                 "enum": [                   "cloud services",                   "virtual machines",                   "azure app service",                   "batch"                   ],                 "options": {                     "dependencies": [                       {"id":"subcategoryadd", "value":true}                     ]                   },                 "description": "select category",                 "propertyorder": 1,                 "type": "string"               },               "subcategory": {                   "id":"subcategoryadd",                 "title": "sub - category",                 "readonly": false,                 "strictproperties": true,                 "description": "select sub-category",                  "options": {                     "hide_display": true                   },                 "enum": [                   "build , deployment",                   "application insights"                 ],                 "propertyorder": 2,                 "type": "string"               }             },             "type": "object"           }         }        },       "type": "object"     }   },   "type": "object" } 

and sample output:

enter image description here

in output form, have highlighted sub-category option in it's select box should loaded on basis of selected category.

for example, if select batch subcategory options a,b,c should shown in select box subcategory , if select azure app service subcategory options d,e,f should shown in select box subcategory.

i trying dependencies in vain. also, tried accomplish using watch , enumsource mentioned here

any helps worth.

thanks!

your category/subcategory relationship can validated using following json schema.

{   "type": "object",   "anyof": [     {       "properties": {         "category": { "enum": ["foo"] },         "subcategory": { "enum": ["asdf", "jkl;"] }       }     },     {       "properties": {         "category": { "enum": ["bar"] },         "subcategory": { "enum": ["asdf", "qwer", "uiop"] }       }     }   ] } 

however, doesn't mean form generator using able create form based on this. i'd impressed if can.


Comments