json-forms icon indicating copy to clipboard operation
json-forms copied to clipboard

Multiple dependency input function

Open appuku10 opened this issue 5 years ago • 1 comments

Hey ,

Code:

`function (names, data, cb) { var schemas = new Object(); var schema = new Object();

schema.type = "string";

if (data.option1 === "efg") {

    schema.title = "efg";
    schema.enum = ["", ""]
    
} else if (data.option1 === "abc") {
    schema.title = "abc";
    schema.enum = ["", ""]
}

schemas["$.suboption1"] = schema;
setTimeout(function(){cb(schemas)},500); // in order to show asynchrony

}`

How can i get dynamic value instead of "option1" , what parameter should i pass to get Parent Option's Id

appuku10 avatar Feb 06 '20 13:02 appuku10

function processOptions(parentId, names, data, cb) { var schemas = {}; var schema = { type: "string" };

if (data[parentId] === "efg") { schema.title = "efg"; schema.enum = ["", ""]; } else if (data[parentId] === "abc") { schema.title = "abc"; schema.enum = ["", ""]; }

schemas["$.sub" + parentId] = schema; setTimeout(function() { cb(schemas); }, 500); // in order to show asynchrony }

peeyush12345 avatar Jun 25 '23 17:06 peeyush12345