Programming Reference Manual
 
The Web Form Editor allows to create an interactive interface between a script that runs on Tradium Web Portal and the remote connected Tradium Web Portal user. It serves as an alternative to the standard Dialog Editor that is widely used in the Tradium Basic Script environment.
 
The lay-out of a Web Form consists of one or more input controls and one, two or three buttons for submitting, resetting of cancelation of the input. Each type of the input control is explained below:
 
 
You can set the title of the form in the upper text box, which defaults to "Tradium Web Form". To add controls, select the control in the drop-down box and click on the "Add" button. To remove a control, select it and click on the "Del" button. You can add up to 16 controls in one Web Form. After inserting the controls you can rearrange them by using the "Up" and "Down" buttons.
 
You can change any caption of the controls, the Web Form itself and also the three control buttons (SUBMIT, RESET and CANCEL) in the bottom of the Web Form Editor. To remove one of the control buttons, simply empty the caption of that button. Please take notice that the SUBMIT button will always appear, otherwise no data entry can be recorded.
 
You do not have to do any marking up; Tradium Web Portal is fully responsive and automatically fits the controls to the screen of the device.To run a Web Form script, use the RunWebForm method. Alternatively, you can use the RunWebNotify method to display a message on the screen and finally, RunWebData creates a scrollable list (table contents), using a SQL query as input only.
 
IMPORTANT: WebSessionID
 
When running a script from the Tradium Web Portal, a special global variable needs to be initialised at the beginning of the main script, WebSessionID. This contains the unique id of the user's online session of the webbrowser. Each script runs autonomously on the local database server via the Tradium e-Comms Server software.. It communicates with the user thru this id.
 
Whenever a script run is initated from the Tradium Web Portal, the Command$ variable begins with the session id, followed by a space (Hex char 20) and eventually specified command line parameters.
 
When testing a script, Tradium does not require the use of WebSessionID, however, it should always be implemented in the script as shown in this example.
 
Example of Sub Main
Sub Main
 
'If executed from the queue,
'the Command string contains
'the sessionID as the first word
If Len(Command$)> 0 Then
         WebSessionID  Split(Command$)(0)
Else
         WebSessionID InputBox("SessionID?")
End If
 
...
...
...
 

Construct of a Tradium Web Form

When a Tradium Web Form is created, much like a User Dialog, the definition of the form is stored in code. While a User Dialog consists of a set of codes, a Tradium Web Form is basically only one string of data. That is because the web form only needs to display information or is to fill in one or more fields. The presentation is done by the web browser itself.
 
Because a web form definition is a single string, you can easily build Tradium Web Forms dynamically. There are only but a few restrictions on the mark up of the definition string: the hash (#) and vertical bar (|) are reserved characters.
Basically, a Tradium Web Form is devided in:
- a Header section
- a Controls section
- a Footer section (buttons area)
 
A Tradium Web Form definition string is also made of sections and properties. Each property in the definition string ends with a # (hash). And each section contains 4 properties. The definition string always starts with the header section, then followed by one or more control sections. The order in wich they appear in the definition string defines the sorting order of the controls on how the will be shown in your web browser.
The four properties always have a distinct order inside a section:
- Control type,
- Caption,
- Value,
- List items.
 
Not all controls use these 4 properties. For example, a CheckBox control does not use list items. In that case, a hash marker will be placed only in the string. The Web Form Editor takes care of this, but if you design the definition string dynamically by code, remember that each control section has exact 4 hashes (#) in place. An example of a webform definition with details description:
 
'zoek naar opmaak definitie (controltype,caption,value,listtems, controltype,caption,value,listtems, ..., controltype,caption,value,listtems)
'Result = RunWebForm("0#Tradium Web Form##Zenden|Reset|Annuleren#" & _
'                                   "6#Invoerdatum#2012-06-21#2010-01-01|2020-12-31|06#" & _
'                                   "2#Land#Nederland#Nederland|België|Frankrijk#" & _
'                                   "5#Opmerking#Dit is een test \n op de tweede regel#3#" & _
'                                   "1#Naam#Van Dalen#text|50#" & _
'                                   "3#Bezorgoptie#Direct#Afhalen|Bezorgen|Direct#" & _
'                                   "4#Vooruitbetaling#True##")
'Formdata:
'                   controltype = Form definition (0)
'                   caption = Tradium Web form
'                   value = n/a
'                   listitems = "Zenden|Reset|Annuleren"
'                   controltype = Datepicker (6)
'                   caption = Invoerdatum
'                   value = 2012-06-21
'                   listitems = valid range from 2010-01-01 to 2020-12-31, Disabled days of the week: 0 and 6
'                   controltype = dropdownbox (2)
'                   caption = Land
'                   value = Nederland
'                   listitems = 3, "Nederland", "België" and "Frankrijk"
'                   controltype = text/area (5)
'                   caption = Opmerking
'                   value = "Dit is een test" & vbnewline & "op de tweede regel"     --take notice that the character sequence " \n " means new-line
'                   listitems = 3|512, the number of rows visible in the control, followed by the maxlength (512)
'                   controltype = inputbox (1)
'                   caption = Name
'                   value = "Van Dalen"
'                   listitems = "text|50", the type of input, options are: "password", "number", "text", "url", "email", "phone", "color", followed by Maxlength (50)
'                   controltype = optiongroep (3)
'                   caption = Bezorgoptie
'                   value = "Direct"
'                   listitems = "Direct","Afhalen" and "Direct"
'                   controltype = checkbox (4)
'                   caption = Vooruitbetaling
'                   value = True
'                   listitems = n/a