CallFunction
If HTMLFunctionsEnable 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. |
CallFunction Event Parameters
Example:
The HTML file contains the following:
|
<html> <head><title>Future Wave Tech WebX</title></head> <body><b>A Test Function:</b> <%=Function MyFunction(P1=Hello%20World&P2=Test)%> </body> |
Visual Basic code contains the following:
|
Option Explicit
Private Sub Form_Load WebX1.HTMLFunctionsEnable = TRUE WebX1.StartServer End Sub
Private Sub WebX_CallFunction (Index As Integer, FunctionName As String) Select Case sFunctionName Case "MyFunction" WebX1.ReturnData Index, MyFunction() Case Else WebX1.ReturnData Index, "Error: The Function _ Call failed. Function " & _ sFunctionName & " was not found." End Select End Sub
Public Function MyFunction(sQS As String) MyFunction = "From a VB Function: " & vbCrLf & _ "<BR>" & vbCrLfEnd Function End Function |
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. The QueryString method can be used to inspect what (if any) parameters where past in by Get/Post methods.