SetAction

Description

Accepts action and context information about user interaction with the Web DataWindow client control in a Web browser so that generated HTML reflects any requested changes.

Applies to

DataWindow type

Method applies to

Web

Server component

Syntax

Web DataWindow server component

integer dwcomponent.SetAction ( string action, string context )

Argument

Description

dwcomponent

A reference to a Web DataWindow server component.

action

A string describing an action associated with a button click or method call in a Web DataWindow client control on a Web page. The value of action is stored in a page parameter called HTMLGenObjectName_action.

context

A string describing the context of action in the Web DataWindow client control. The string is generated by a Web DataWindow script and the value is stored in a page parameter called HTMLGenObjectName_context.

The format is not documented and subject to change.

Returns

Returns 1 if it succeeds and one of these negative values if an error occurs:

Usage

When the user clicks a button in the Web DataWindow client control, the JavaScript for the control stores the action in a page parameter called HTMLGenObjectName_action, and it stores the context in a page parameter called HTMLGenObjectName_context. These parameters are passed to the page server which uses them to call the SetAction method for the server component.

The SetAction method uses the SetHTMLAction method of the DataWindow.

Call GetLastError and GetLastErrorString to get information about database errors that cause SetAction, Update, Retrieve, and RetrieveEx to return –1.

For information about using the Web DataWindow, see the DataWindow Programmers Guide.

Examples

Example 1

This JSP example calls SetAction for the server component called dwGen:

int retVal;

String dw_1_action =(String)request.GetParameter     ("dw_1_action");

String dw_1_context = (String)request.GetParameter     ("dw_1_context");

if (dw_1_context == null){

	dw_1_context = " ";

}

// Check if we need to perform the action

if (dw_1_action!=null){

  retVal = dwGen.SetAction(dw_1_action, dw_1_context);

  if (retVal < 0 ) {

	out.print("Error on SetAction: "			+ retVal + "<BR>");

	out.print(dwGen.GetLastErrorString()+ "<BR>");

  }

}

See also