|
This example shows the use of the
InputValidateDateFields property.
Press the 'Add New Record' button and note that a javascript alert arises, asking the user
to modify the input, according to current date format.
Such date format is automatically determined by VBSdb, depending upon the session.lcid
value (that can be freely decided by the developer, according to the current user nationality).
You can use the VbsDbGetDateFormat method to get the date format that will be used in
the client side validation (you could display such date format in the alert message or in
the form header).
Add a new record
This is the code implementing the example:
<!--#include file="VBSdb/inc.asp"-->
<%
session.lcid = 1033
VbsDbNew objVbsDb
objVbsDb( "MdbPath" ) = "data/nwind.mdb"
objVbsDb( "Sql" ) = "select EmployeeId,LastName,FirstName,BirthDate from Employees"
objVbsDb( "ViewNavigationButtons" ) = "first;prev;next;last;search;add;update;delete"
objVbsDb( "EditTableName" ) = "Employees"
objVbsDb( "EditKeyFields" ) = "EmployeeId"
objVbsDb( "EditFields" ) = "LastName;FirstName;BirthDate"
objVbsDb( "EditAddFieldDefaults" ) = "LastName|MyLastName;FirstName|MyName;BirthDate|Not a date!"
objVbsDb( "InputValidateDateFields" ) = "BirthDate|BirthDate is not a valid date (format is 'MM/DD/YYYY hh:mm:ss')"
objVbsDb( "GlobalStartScreen" ) = "Add"
VbsDb objVbsDb
%>
This demonstrative program connects to
Nwind.mdb, the well known Microsoft Access sample database: the names of companies,
products, people,
characters, and/or data mentioned herein are fictious and are in no way
intended to represent any real individual, company, product, or event.
To download a copy of Nwind.mdb, please visit
Microsoft's site.
|