FieldEdit and FieldChange are two events that are triggered when a user changes the contents and leave a field on the page.
So why do we need two events after the field content is modified?
We know that FieldEdit is usually used to perform validations other than standard system edits (such as Required, data type etc) and FieldChange is used to recalculate page field values.
What happens if I use FieldEdit to recalculate the page field values or FieldChange for validations?
In order to understand the reason for why there are two events, we need to understand how the component processor handles field modification.
When a user modifies the field value and tab out (or leave the field), following processing happens in sequential order.
- Standard system edits are performed .
- If there are no system edit errors, FieldEdit event is triggered.
- If there are no errors triggered from FieldEdit peoplecode, modification to the field value is accepted by the component processor and is updated to component buffer.
- FieldChange event is triggered.
During FieldChange, field value is already accepted by component processor and is updated to component buffer, hence it make sense to recalculate any other dependent field values in FieldChange peoplecode.
I hope the difference is clear, now please answer my questions. :)
What happens if I use FieldEdit to recalculate the page field values or FieldChange for validations?