/
Dynamically set required fields
Dynamically set required fields
In majority of cases fields, that must be filled-in before form submission (required fields) are known ahead even before user have entered data on the form. However in some rare cases decision, which fields will be required and which won't is made later, when user have entered some data on the form.
To solve this problem right now we:
- create
setRequiredFields
method in event handler - call it from following events:
- OnPreCreate/OnNew - when user opens new item addition form
- OnBeforeItemCreate - when user tries to create an item
- OnBeforeItemUpdate - when user tries to update an item
Doing so each time is a time consuming and it's possible for a developer to forget which events should call new method.
To automate this I propose to have a build-in setDynamicRequiredFields
method with empty content, that already would be called form events mentioned before. This way developer only needs to override it in his event handler and put logic in there.