Preference 'enum' default not selected

Can someone tell me what is wrong with this statement? It doesn't select the default. I get a null error until I manually select an item.

input name: "itemSelect", type: "enum", title: "Item Selection", defaultValue: 0, required: true, multiple: false, options:[0:"Disabled", 1:"Unit 1", 2:"Unit 2", 3:"Unit 3"]

The docs say
"* ENUM: any of a predetermined list of possible String values"

So when without quotes, your keys are being treated as strings and integer 0 doesn't match.

defaultValue: "0"

should work.

2 Likes

That did it, thanks.