I already wrote a "compatible" answer to this question here . The rule (for me) is that there should not be any logic in the user interface, except for the user interface logic, and requires standard procedures that will manage general / specific cases.
In our situation, we have come to the conclusion that the form code is automatically generated from the list of controls available in the form. Depending on the type of control ( bound text, bound boolean, bound number, bound combobox, unbound label, ... ) we automatically generate a set of event procedures (such as beforeUpdate and afterUpdate for text controls, onClick for labels, etc. ) That run common code located outside the form.
This code can either generate general things (if the value can be updated in beforeUpdate , arrange the set of records in ascending / descending order onClick event, etc.) or specific procedures based on the form and / or name of the control (for example, some work in afterUpdate event, for example, calculating the value of the totalAmount control unitPrice value and quantity ).
Our system is now fully automated, and the creation of forms is based on two tables: Tbl_Form for a list of forms available in the application, and Tbl_Control for a list of controls available in our forms
Following this answer and other posts in SO, some users asked me to develop my ideas. Since the subject is quite complex, I finally decided to open a blog to talk about this UI logic. I have already started talking about the user interface, but it can take several days (.. weeks!) Until I can specifically cover the object of interest to you.
source share