how to get the value of a field into a variable when the field is created or updated on the form level.

Hello every one i want to know that is this possible to get the value of a field into a variable when the field is created or updated on the form level.

Suppose we have a field called customergroup in my form if i change or create the new value in this field and close the form then my code is hitted there in my code in need that changed value …

i am stuck on this issue kindly please give your suggestions if any…