SetAction method (DataWindows)
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.
Controls
DataWindow type |
Method applies to |
---|---|
Web |
Server component |
Syntax
[Web DataWindow server component]
1 |
integer <span>dwcomponent</span>.<span>SetAction</span> ( string <span>action</span>, string <span>context</span> ) |
Argument |
Description |
---|---|
dwcomponent |
A reference to a Web DataWindow server |
action |
A string describing an action associated |
context |
A string describing the context of action in The format is not documented and subject to change. |
Return Values
Returns 1 if it succeeds and one of these negative values
if an error occurs:
-
-1
Reloading the current context failed
-
-2
The action was attempted but it failed
-
-3
The action could not be performed (for example, the action
was InsertRow but the DataWindow has no editable fields for entering new
data) -
-4
The action was aborted by the HTMLContextApplied event
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
This JSP example calls SetAction for
the server component called dwGen:
1 |
int retVal; |
1 |
String dw_1_action =(String)request.GetParameter     ("dw_1_action"); |
1 |
String dw_1_context = (String)request.GetParameter     ("dw_1_context"); |
1 |
if (dw_1_context == null){ |
1 |
dw_1_context = " "; |
1 |
} |
1 |
// Check if we need to perform the action |
1 |
if (dw_1_action!=null){ |
1 |
  retVal = dwGen.<span>SetAction</span>(dw_1_action, dw_1_context); |
1 |
  if (retVal < 0 ) { |
1 |
out.print("Error on SetAction: " + retVal + "<BR>"); |
1 |
out.print(dwGen.GetLastErrorString()+ "<BR>"); |
1 |
  } |
1 |
} |