Unexpected behavior with "No Selection" for app input

I have an app input setting called myValue with a type enum. If I choose the option "No selection" then myValue is no longer listed in the settings, totally disappears.

I find this a bit odd. I expected it to be null or perhaps a zero length string but to have it disappear altogether seems wierd given I've taken the trouble to define it and give it a default value.

Is there a way to remove this option? It's presence only adds to the error checking that must occur and is likely to produce an unintended outcome?

1 Like

The defaultValue option applies only to the default selection in the interface the first time the app page is loaded, but it does not write a value to settings on its own (not until the user saves the app with that selection). If the input is not required, then your code should be written to handle a null or no value for that particular setting (though really it's a good idea to handle this gracefully regardless--it could still happen).

To address your particular question, it sounds like required: true might do what you want. For other ways to handle this, you could specify some default value in your app code to use in case there is no user-supplied (or otherwise stored) value (e.g., perhaps pulling it from a static field variable you defined for this purpose, among other options).

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.