webtrigger…end
Define a trigger in a DSP that will be executed on the client browser.
webtrigger WidgetTriggerName {ScopeBlock} {ParamsBlock} {JavaScriptBlock} end
Arguments
Parameter | Description |
---|---|
TriggerName | Name of supported trigger, such as detail, onEdit, or showError. |
ScopeBlock | Specifies the data to be included in a DSP request-response exchange. For more information, see scope…endscope. |
ParamsBlock | Defines the trigger's parameters, if supported by the widget. For more information, see params…endparams. |
JavaScriptBlock | Defines a block of JavaScript code that
conforms to the
Data Format of External Client-Side Triggers and Operations. For more information, see javascript. This block is required when maintaining JavaScript in the Uniface IDE. It can be omitted if the JavaScript definitions are externally defined, for example in an external layout or JavaScript files that are available in the runtime environment. |
Return Values
Not applicable.
Use
Declare in the fields of Dynamic Server Page components.
Description
Use the webtrigger instruction to define a client-side trigger, which is executed in the client browser and implemented as JavaScript. The JavaScript definition can be defined internally using the ProcScript Editor, or externally in your own DSP layout or JavaScript files. In this case, you can use your own preferred editor.
Parameters for client-side triggers depend on the widget and the trigger. If required, they must be declared in ProcScript preceding the javascript instruction. Variables, however, must be declared in JavaScript.
The public web and partner web instructions are not allowed in a web trigger definition because they are executed asynchronously on the server whereas the webtrigger implementation is executed on the client.
At runtime, client-side triggers are executed by the browser when the user performs the associated action, for example, clicking a button that invokes the detail trigger, or when validation or syntax errors have occurred.
If a webtrigger is defined with the same name as a trigger, the last one defined is the one that is used.
For more information, see Client-Side Triggers and Operations.
Compiler Warnings and Errors
During compilation, Uniface issues warnings and errors if the webtrigger and javascript blocks are incomplete, incorrectly defined, or used in the wrong locations. It does not check the JavaScript syntax, although it will issue errors if it encounters ProcScript in a JavaScript block.
Number | Type | Compiler message |
---|---|---|
1 | Error | WebTrigger only allowed in widget or detail trigger |
2 | Error | Missing EndJavaScript |
3 | Warning | JavaScript only allowed in Dynamic Server Page component |
4 | Error | WebTrigger does not require a name in the detail trigger |
5 | Error | Operations or WebOperation only allowed in Operation trigger |
6 | Error | JavaScript tag only allowed in WebOperation or WebTrigger |
7 | Error | WebTrigger only allowed in DSP component |
8 | Error | ProcScript statement found in WebTrigger or WebOperation |
9 | Info | Skipping WebTrigger TriggerName; it is overlayed |
10 | Error | WebTrigger does not have a name. |
11 | Error | "public web" or "partner web" not expected in WebTrigger or WebOperation |
12 | Error | Found more than one javascript block in module |
webtrigger OnEdit scope input ; Data in this DSP is sent, but not expected to be returned endscope javascript alert("onedit fired."); // Check whether OnEdit trigger is fired endjavascript end
Version | Change |
---|---|
9.5.01 | Introduced |