OpenWGA 7.6 - OpenWGA Concepts and Features

Design and development

TMLScript

TMLScript is the expression and procedural programming language used throughout OpenWGA.

TMLScript is actually JavaScript, a programming language normally being used and executed in Internet Browsers to perform a wide range of clientside functionalities. TMLScript in OpenWGA 5 matches JavaScript version 1.7, meaning it has the same syntax and all (browser independent) objects, functions, statements and operators defined for that version standard.

Two fundamental things are different in TMLScript compared to the JavaScript known from browsers:

  • TMLScript is executed exclusively on the OpenWGA server, not in the browser. Most of the time this happens while a WebTML page is rendered, but there are various other ways to run TMLScript
  • There are none of the browser objects available that are known from JavaScript, like "window", "document" etc. The basic object for TMLScript is always the same and is called TMLContext. It represents the context of the TMLScript inside the WebTML/OpenWGA environment and grants access to all available functionalties

TMLScript is usable at very many occasions in OpenWGA. Only some examples:

  • By creating a tag <tml:script> on a WebTML page and filling it with arbitrary script code

<tml:script>

    var x = [];

    for (let con in Iterator(content().getChildContents())) {

        x.push(con.getTitle());

    }

</tml:script>

  • By using a WebTML condition tag like <tml:case> and specifying the condition in attribute condition in TMLScript

<tml:case condition="STATUS == 'w'">

  • By calculating the contents of any WebTML tag attribute dynamically, which can be done by letting the attribute value start and end with curly braces "{" and "}" and giving a TMLScript expression inside that is processed on each invocation to build the final attribute value (see Dynamic WebTML attributes)

<tml:item name="{ isDefined('description') ? 'description' : 'body' }"/>

  • In WebTML form validations

<tml:input name="lastname" type="text" validation="!isEmptyValue($E_VALUE)" message="Please enter a last name"/>

Table of contents: