Automatically selecting None in optionfield

I am writing a code to allow the user to replace soil layers in a geotechnical length profile. This is done by selecting the soil the user wants to replace from an optionfield, then select between which bounds and then finally the soil that should be used as a replacement.

Now I have the situation where it is possible for an ‘unknown material’ to appear in the geotechnical length profile which must be replaced by the user. Now as an example, when I test my code I replace all ‘unknown materials’ with ‘sand’. After doing so the soil type ‘unknown material’ no longer exists in the geotechnical length profile. Therefore the optionfield is updated to no longer have ‘unknown material’ as an option for soil to replace. However, VIKTOR remembers ‘unknown material’ as the selected option and thus gives an error as can be seen below.

My question is whether it is possible to automatically select None in this OptionField when the field contains an invalid value.

The selected option is stored in the database (params). Automagically updating this value is not possible, since it is, from a product point of view, not desirable. Your option is to use a SetParamsButton to replace the desired params.