vf_bool()

Validates the data entered in a F_BOOL field

Call
#include <vv_bool.h>
int vf_bool(stp, picp, dfldp, cvbufp)

UCHAR *stp

Pointer to the string containing the field data

UCHAR *picp Pointer to the picture associated with the string
DFIELDPTR dfldp Pointer to Boolean field to validate
UCHAR *cvbufp Pointer to conversion buffer
Returns
1 The data is valid for this F_BOOL field.
0 The data is invalid for this F_BOOL field
Description

vf_bool() validates the data in the specified Boolean field. If this Boolean field is a toggle field, the data is considered valid, and vf_bool() returns a 1.

If the field is not a Boolean toggle field, vf_bool() checks the character in the field against the characters specified in the field structure as the allowed Boolean characters. The check is case insensitive. The check fails if the character in the string does not match one of the allowed Boolean characters. If the check fails, VAL_ERR is set to INV_BOOL. This will cause the form editor to return to the field and display the validation message in the error window. After the INV_BOOL message is printed, the allowed Boolean characters for that particular field are printed surrounded by single quotes, with a slash character between them. For instance, if the field is set to accept 'T' and 'F', the message is printed as "Entry must be T/F".

Vermont Views validation messages are defined in vv_valmsg.c.

The default allowed Boolean characters are 'y' and 'n'. The allowed Boolean characters for a specific field can be changed with sf_boolch(). The global defaults can be changed with se_boolch().

Related Functions

vf_ch(), vf_date(), vf_dec(), vf_fill(), vf_double(), vf_int(), vf_long(), vf_req(), vf_st(), vf_time()

Cautions

This function does not do any checking for toggle fields.


Home Contents Previous Next