I have a form with a field that contains predefined options, however some of these options are not valid when another field in the form has certain data. Eg, I don't want to give the user the option to set their occupation as retired, when their age is below 30.
Following the documentation, I thought this would be possible by querying the form data source within the PropertyDataSourceProvider's GetSourceForKey method. While this works initially, it doesn't get called again until the form is manually reloaded.
My question is, is there a means to recalculate the options available for a field when data is committed back to the form's data source, or when validation is run?
Calling Reload on the form would probably do the job, but seems like overkill, and isn't very performant.
Validating the field based on the form data is another option, but this is pretty rubbish UX - why give the user the option to choose an item if it is instantly marked as invalid when chosen?