webformitemcheck
ITEM
,
MESSAGE
,
FORMULA

The webformitemcheck statement uses a formula to check the validity of a web form item.


Parameters

This statement has three parameters:

item – name of the form item to check, which must match a post argument in the submitted HTTP POST query.

message – error message if there is an error.

formula – formula to check form item. If the formula is true (or if the formula itself is missing), the message parameter will be added to the error dictionary.


Description

This statement uses a formula to check the validity of a web form item. Here’s a simple example that checks to make sure that a name has been entered:

webformitemcheck "Name","Please enter a name.",import()=""

Here’s a more complicated example that checks to make sure that the name contains at least two words and doesn’t contain any non alphabetic characters (except for space):

webformitemcheck "Name",
    "Please enter a valid name.",
    wordcount(import())<2 or rangenotmatch(import(),"AZaz  ")

How carefully the data is validated is up to you. The procedure can use multiple webformitemcheck statements to check multiple web form items. (You should not, however, use more than one webformitemcheck statement for a single web form item. If you do, the webformerrors( function may not list all of the errors.)

Generating a List of Data Entry Errors

A particular form can have multiple data entry problems. To generate a list of all the problems, use the webformerrors( function. Here’s an example.

webformitemcheck "Name",
    "Please enter a valid name.",
    wordcount(import())<2 or rangenotmatch(import(),"AZaz  ")
webformitemcheck "Card",
    "Please enter a valid credit card number.",
    cardvalidate(import())=false()
webformitemcheck "CardYear",
    "Your credit card is expired or has an invalid expiration date.",
    cardexpirevalidate(webformitemvalue("CardMonth"),import())=false()
cgiHTML=webformerrors("<ul>")
if cgiHTML<>"" rtn endif
...
... continue with data entry procedure
...

See Also


History

VersionStatusNotes
10.2No ChangeCarried over from Panorama 6.0.