I have color and enum controls on a page. I would like to be able to load some alternate settings (a sort of profile) that would let the user select a different set of colors.
I have found the documentation but there seems to be no way of setting these values (COLOR or ENUM) programmatically as far as I can tell. I did find an example of someone using this format to specify a type.
app.updateSetting("tbw", [value:5, type:"enum"])
But trying this approach has not worked for me. It does not generate an error but nor does it make the necessary change to the device settings.
Don't know where to go from here. Any and all suggestions appreciated.
I'm judging the success or failure by doing a refresh on the database value. The other oddity I'm seeing is that the datatype sometimes changes, but I'm not 100% clear on the rules for when and why it does this.
If I call the code while the affected controls are visible on the page then the values DO NOT get set. (Or perhaps they do get set and immediately overwritten by the refresh of the affected object.)
If I call the code while the affected controls are invisible then the new values DO get applied properly.
This seems like peculiar behavior which undermines the functionality of the app.updateSetting(). At best it's a noteworthy limitation, at worst it's a bug so I'm going to tag @bravenel , mainly because I don't know whom else to tag.
So I think the solution in my case is something like: if (state.isVisible == true) input name: "myColor", type: "color", title: "Text Color", required:false, defaultValue: "#000000", width:2, submitOnChange: true
and then I have a master switch with which I can turn all of the controls off at once and change the settings. Finally turn the contols back to visible. A little clumsy but it could be worse.