CallFunctionEvents:CallFunction
If HTMLFunctionsEnableProperties:HTMLFunctionsEnable (see section 3.1.4) is set to TRUE, this event will fire whenever the Function tag is found in an HTML file. When the event is raised, the application can then return a string that will be substituted for the function call tag before the HTML page is sent to the client. See example below:
Parameter | Type | Description | |
Index | Integer | The index of the connection requesting a file. | |
FunctionName | String | The virtual function that is specified in HTML. | |
QueryStringMethods:QueryString | String | The full Query String in the URL. E.g. If you request http://www.mydomain.com/index.html?Name=Joe, QueryStringMethods:QueryString will contain ?Name=Joe. | |
Table 3.2.1 – CallFunctionEvents:CallFunction Event Parameters
Example:
The HTML file contains the following:
<html> |
<head>
<title>Future Wave Tech WebX</title>
</head>
<b>A Test Function:</b>
<%=Function MyFunction(P1=Hello%20World,P2=TestCGI Environment Variables:DATE_GMT)%>
</body>
Visual BasicVisual Basic code contains the following:
Private Sub Form_Load |
WebX1.HTMLFunctionsEnableProperties:HTMLFunctionsEnable = TRUE
WebX1.StartServerMethods:StartServer
End Sub
Private Sub WebX_CallFunctionEvents:CallFunction(Index As Integer, FunctionName As String)
Select Case sFunctionName
Case "MyFunction"
WebX1.ReturnData Index, MyFunction(Methods:QueryString)
Case Else
WebX1.ReturnData Index, "Error: The Function _
Call failed. Function " & _
sFunctionName & " was not found."
End Select
Exit Sub
Public Function MyFunction(sQS As String)
MyFunction = "From a VB Function: " & vbCrLf & _
"<BR>" & vbCrLf
Index is used to track which TCP connection is making the request and must be passed back to WebX when responding to this event with the ReturnData method.
FunctionName is the virtual function name that is being called from HTML, <%=Function MyFunction("Hello World") in this example.
QueryStringMethods:QueryString holds any additional parameter that are passed.