When you execute the
RunWebForm function in a Tradium Basic Script macro, the function returns a Variant type value. If the web user does not response properly within a decent amount of time, which is default , the function returns an empty string. Otherwise, the result is formatted as an XML string.
The outline of the XML formatted result string is like this:
<webform> <response>
<caption>{caption of the first control}</caption>
<value>{returned value of the control}</value>
</response>
<response>
<caption>{caption of the second control}</caption>
<value>{returned value of the control}</value>
</response>
...
...
...
<response>
<caption>{caption of the nth control}</caption>
<value>{returned value of the control}</value>
</response>
</webform>
You can test any designed web form just by running it in a sample script, before implementing the
RunWebForm command in a real world script. For example, copy and run the script below:
Sub Main Dim RetValue As String RetValue = RunWebForm("0#Tradium Web Form##SUBMIT|RESET|CANCEL#" & _ "7#Invoerdatum#2023-01-01|2024-10-01#2012-06-16|2021-01-02|06#" & _ "4#Optie een###" & _ "4#Optie twee###" & _ "5#Beschrijving#Dit is regel 1 \n en dit is regel 2#5|512#") Msgbox RetValue Dim myXml As New ChilkatXml, myControl As New ChilkatXml Dim n As Integer, z As Integer If myXml.LoadXml(RetValue) Then z = myXml.NumChildrenHavingTag("response") For n = 0 To (z - 1) 'zero based array! Set myControl = myXml.GetNthChildWithTag("response", n) If Not myControl Is Nothing Then Debug.Print "Caption: " & myControl.GetChildWithTag("caption").content Debug.Print "Value: " & myControl.GetChildWithTag("value").content Debug.Print "----------------------------------------" End If Next End If End Sub
|
You will also see an dialog which emulates a web form in a web browser. Please take notice that in the real world the layout and mark up is totally different and dependend on the used web browser and styling of your Tradium Web Portal.
Click here for info about the WebForm Simulator.