vf_date()

Validates the data entered in an F_DATE field

Call
#include <vv_date.h>
int vf_date(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 the date field to validate
UCHAR *cvbufp Pointer to conversion buffer
Returns
1 The data is valid for this F_DATE field.
0 The data is invalid for this F_DATE field
.Description

vf_date() validates the date entered into a date field. If the string in the field has a numeric representation of the month, the string is reformatted, if necessary, to match the date format string specified in the field structure. If necessary, the string is padded with the date pad character. Dates that use string representations of the months (i.e., "May") are not reformatted.

vf_date() performs several validation checks on the date string. If the data does not pass a validation check, VAL_ERR is set. The form editor will then display the appropriate message. The following table lists the validation checks and the message displayed in the error window if the check fails.

vf_date() checks for: Message:
A proper date in the specified format INV_DATE followed by proper format
A date in the range specified for the field, if any OUTOFRANGE
The checks for a proper date are:
  • The month is from 1 to 12 or is a valid sub-string if specified in string format (for example, "May"). Specified month strings must be unique. Therefore, "J" and "JU" are illegal, but "JUN" is accepted as June.

  • The day is not 0 and is not larger than the number of days in the specified month. Leap years are taken into account.

Vermont Views validation messages are defined in vv_valmsg.c.

Related Functions

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


Home Contents Previous Next