OpenWGA 7.10 - OpenWGA Concepts and Features

Design and development » HDBModel framework » Relations in HDBModel

Choosing a relation target on WebTML forms

To let your user actually choose relation targets when he enters the data of your document you need to give him a WebTML input field for this. This normally would be a <tml:input> of types "select", "radio" or "checkbox".

As we already clearly defined what document we want to target on the relation OpenWGA is able to assist us here in retrieving the options. A WebTML input will automatically offer valid target documents if the following conditions are met:

  • The name attribute is the name of a defined relation for the content class that is edited
  • The attribute relationtype is used, so it is clear that the input field should get stored as relation
  • The type attribute is a type that is able to offer selection options

A WebTML input like the following may be used to let users choose a target customer on a project:

<tml:input name="customer" relationtype="protected" type="select"/>

The WebTML input will use the titles of the target documents as option titles. If you want something different you may use the attribute optionstitle. It contains a TMLScript expression that is evaluated against every target document to form an individual title:

<tml:input name="customer" relationtype="protected" type="select" optionstitle="TITLE + ' (' + country + ')'"/>

For relations that build relation groups you of course need to use a control that allows multiple inputs, like checkboxes:

<tml:input name="tasks" relationtype="normal" type="checkbox"/>