In order to get access to form and field information, you need a pointer to the form that contains the field. In many cases, your user function is passed a pointer to the current form as one of its parameters.
Getting a Pointer to the Current Form
Getting a Pointer to a Form Using the Form Name