Hello,
I am trying to render switch input question in the editor widget, but I am able to see the dropdown question. Please let me know if I have missed something.
Please find the screenshot attached for the same
Below is the code that I have used
const fields = [
{
name: "ObjectID",
alias: "ObjectID",
type: "oid"
}, {
name: "inspector",
alias: "Inspector name",
type: "string"
},
{
name: "inspdate",
alias: "Inspection date",
type: "date"
},
{
name: "floodinsur",
alias: "Flood insurance",
type: "string",
domain: {
type: "coded-value",
name: "floodinsur",
codedValues: [
{
name: "ATM",
code: "atm",
},
{
name: "Bar",
code: "bar",
},
]
}
},
{
// dropdown
name: "fieldElt",
alias: "Field ELement",
type: "string",
domain: {
type: "coded-value",
name: "fieldElt",
codedValues: [
{
name: "ATM", // value
code: "atm", // key
},
{
name: "Bar",
code: "bar",
},
]
}
},
{
name: "fieldEt",
alias: "Checkbox element",
type: "string",
domain: {
type: "coded-value",
name: "fieldEt",
codedValues: [
{
name: "Yes",
code: "yes"
}
]
}
}
];
const FieldElement6 = new FieldElement({
fieldName: "fieldEt",
label: "Switch",
input: {
type: "switch",
offValue: "yes",
onValue: "no"
}
})
const formTemplate = new FormTemplate({
title: "Inspector report",
description: "Enter all relevant information below",
elements: [FieldElement6]
});
const layer = new FeatureLayer({
source: graphics, // client side graphics
fields,
outFields: ["*"],
formTemplate
})
Thank you
Karthikeyan Shanmugam