Using Server-Side Data Validation
\The Sandbox \PB History & Future \New In PB7 \HTML DW \Server-Side Data Validation
What is the
HTML DW
Configuration for
HTML DW
Trying the
HTML DW
Alternate
Configurations
HTML DW
App
Customized Server
Component
Server-Side
Data Validation

The DataWindow object can include validation rules derived from DataWindow expressions, but sometimes you want to use more complex logic or you want to reuse standard scripts that are maintained on the server. The HTML DataWindow provides a way to insert additional server-side validation routines into the update and retrieval process.

Where you implement the validation code

Server-side validation requires you to define one or more PowerBuilder custom class user objects called service classes. These service classes are stored in the same PBL or PBD as the DataWindow object for the server component.

The service classes implement user-defined events with prescribed signatures. These events correspond to standard DataWindow events. In the user-defined events, you validate the data and specify return code that tell the server component whether to cancel the corresponding DataWindow event.

In the server component, you set a property or call a method that identifies these user objects as service classes for the server component.

How the validation code is called

Server-side validation works like this:

  1. Service classes are instantiated when the component is instantiated (if they are specified in a Jaguar property) or when they are first registered by the SetServerServiceClasses method.
  2. An event occurs in the server component for the DataStore.
  3. The server component calls an event of the same name in each registered service class.
  4. If the service class implements the event, the event script is executed and a return code is sent back to the server component.
  5. If the event can be canceled via a return code and if any of the service classes returns that code, the event is canceled in the server component.

PBL Peeper PB Help PB History
& Future About Us Feedback Site Map

Google
 
Web www.techno-kitten.com
www.sybase.com