Monday, September 15, 2008

FieldChange Vs FieldEdit

Use FieldChange PeopleCode to recalculate page field values, change the appearance of page controls, or perform other processing that results from a field change other than data validation. To validate the contents of the field, use the FieldEdit event.

The reason this topic comes up is because we have found that FieldChange does behave different to FieldEdit.

Recently, wehave seen some design that put the validation into FieldChange, it is incorrect. PeopleSoft has made it clear that FieldEdit is for data validation and FieldChange is for anything else other than data validation. Alternatively you can put it into SaveEdit (not SavePreChange or SavePostChange), please see the PeopleSoft Component Process Flow.

For example, if you have Field A, B and C and you put your data validation against Field A in FieldChange event, Here is what happened:

1) You deliberately typed an invalid data into Field A.
2) PeopleSoft popped up an error message
3) You clicked ok
4) You ignore the data error in Field A (even though it is highlighted in Red)
5) You continue type in data in Field B and C
6) I believe you can even Save it! Or in the case of Add mode, you can even Add it.
However, if you put your data validation in FieldEdit, then every time you try to save it, it will always popped up the error message regarding data error in Field A.

No comments: