2012-10-08

Enabeling field in forms based on other field value

Quite simple solution but something I keep forgetting how to set up.

You want to enable or disable a field in a form based on the value of a different field. here is how I solved in a recent project.

On the table add a method to check the value of the main field (field that controls the functionality)


On the field that should be eneblad, add a modified method

Finaly you need to add the same code on the Active method on the datasource of the form


Note that if you add your code prior to the call to Super() you will get unexpeted result.

Make sure the to set the field (on the form) property Autodeclaration = True
It is proabaly a god idea to base the enebaling on a boolean or enumeration expression, rather the a string value.

Inga kommentarer:

Skicka en kommentar