|
This example shows the use of the
EditValidateRegExp property.
If you submit the Add form, a Javascript error message will arise, to advise
you that UnitsInStock does not contain an integer (numbers from 0 to 9999 are allowed).
Add a new record
This is the code implementing the example:
<!--#include file="VBSdb/inc.asp"-->
<%
VbsDbNew objVbsDb
objVbsDb( "MdbPath" ) = "data/nwind.mdb"
objVbsDb( "Sql" ) = "select ProductId,ProductName,UnitsInStock from Products"
objVbsDb( "GridFields" ) = "ProductName"
objVbsDb( "ViewNavigationButtons" ) = "first;next;prev;last;search;add;update"
objVbsDb( "GlobalStartScreen" ) = "Add"
objVbsDb( "EditTableName" ) = "Products"
objVbsDb( "EditKeyFields" ) = "ProductId"
objVbsDb( "EditFields" ) = "ProductName;UnitsInStock"
objVbsDb( "EditAddFieldDefaults" ) = "ProductName|myProduct;UnitsInStock|2a2;"
objVbsDb( "EditValidateRequiredFields" ) = "ProductName|ProductName is required"
objVbsDb( "EditValidateRegExp" ) = "UnitsInStock|[0-9]{1,4}|UnitsInStock is not an integer!"
%>
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.
|