Checking that the Field Entry is in the Allowed Range

You must include code to check that the field entry is within the allowed range, if one is specified. You do not have to include this code if (1) you call one of the existing field validation functions or (2) you are not implementing range checking for this field type.

To do the range check, you must first determine if a range structure is installed for the field. Thus, if dfldp->rangep does not equal NULLP, there is a range that must be checked.

To access the range structure, you should dereference the rangep member in the field structure, cast it to the appropriate pointer type, and then store it in a local variable of the appropriate type. For example, for integer fields you would do the following:

RGINTPTR rangep;

rangep = (RGINTPTR) dfldp->rangep;

To access the minimum value of the range structure, you would then use rangep->min. To access the maximum value of the range structure, use rangep->max.


Home Contents Previous Next