See also: fvDate |
Function used to determines whether or not the passed value is a properly formatted date. If the value is not a properly formatted date, then the proper value is returned.
JSV_fsDate(expV [, emptyOK])
n/a
The fsDate function returns VALID
if expV
is a valid date, EMPTY
if expV is empty; otherwise, INVALID
.
The fsDate function uses the following arguments.
Argument | Description |
expV | The date string. |
A properly formatted date is of the form mm/dd/yyyy, where mm is any valid month value 1-12 (leading zero is optional), the dd is any valid day value for the month 1-31 (leading zero is optional), and the year is a four-digit year.
JSV_occurs, JSV_parseString, JSV_isWhitespace, JSV_allowInString, JSV_toString, JSV_isMonth, JSV_isDay
The following lines of code
function CheckField() {
var isValidDate = JSV_fsDate(document.DateForm.MyDate.value);
if (isValidDate == EMPTY)
alert("This field DOES NOT contain a valid date.");
else if (isValidDate == INVALID)
alert("This field contains an INVALID date.");
else
alert("This field contains a VALID date.");
}
<FORM NAME="DateForm">
<B>Date:</B>
<INPUT TYPE="Text" NAME="MyDate" SIZE="10" MAXLENGTH="10"
onBlur="JSV_fsDate(this,true);">
<INPUT TYPE="Button" NAME="DateCheck" VALUE="Check">
</FORM>
produce
Enter a date and click the Check button.
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.