ValidationError

The ValidationError event has different arguments for different objects:

Object

See

psPage

Syntax 1 For psPage objects

PSPasswordClass, PSTextAreaClass, PSTextClass

Syntax 2 For server-side text controls

For use with PSWebDataWindowClass objects, see ValidationError in the chapter on server-side Web DataWindow events.


Syntax 1 For psPage objects

Description

Occurs if the psPage.Validate event returns false or if any control's Validate event returns false.

Arguments

None

Returns

None

Usage

Use this event to report any validation errors.

One way of reporting validation errors is to place an error message in a Static Text control that you make visible when an error is detected. Another way is to call the Alert method to open a client-side alert box after the page is displayed. A third way is to call ReportError.

The first two ways display validation errors to the client. If you want to plug validation errors into the standard error processing mechanism, use ReportError.

NoteError processing Because this event is triggered before generation occurs, psDocument.Write cannot be used for reporting errors. Instead, you can use the ReportError method on the psPage object to trigger the ServerError event. The error is then added to the error log, depending on the ServerError return value.

Examples

Example 1

This code in the ValidationError event for a logon window makes visible a previously hidden Static Text control (containing text indicating an invalid password). It also sets the logonValid variable to false:

st_invalid.visible = true;
logonValid = false;

See also

Alert


Syntax 2 For server-side text controls

Description

Occurs if the control.Validate event fails.

Applies to

PSPasswordClass, PSTextAreaClass, PSTextAreaClass

Arguments

Argument

Description

sNewValue

String variable for the user-entered value that fails the control.Validate test

Returns

None

Usage

Use this event to report validation errors on user-entered data.

See also

Validate