0

Nodes and Part Templates

Description

The system applies templates to nodes and parts to control the way they appear to users and end users. By default, parts print their output directly to the content buffer; for example, a text_input part prints the caption followed by the html input control (<input…>) to the content buffer and the web page generates from this buffer. It is possible, however, to control the printing with node and part templates, making it possible to do things like print the part caption to a specific div structure. If you use a part template, the system will write the specific output elements, such as caption and control, to variables.

Elements

Element Description

control

This is the main html output of the part. For text_input parts this is the “<input… />”.

caption

This is the interpolated version of the part caption parameter.

prefix

This is the interpolated version of the part prefix parameter.

postfix

This is the interpolated version of the part postfix parameter.

validation

This is the message the system displays to the user when the first validation rule fails.

mandatory

This is ‘mandatory’ when you have enabled a mandatory validation rule. Otherwise, use ‘’.

additional_info

This relates to icons to indicate whether a Note or Photo is attached.

reference

This is the icon to indicate resources references are linked to this part.

validation_mark

This is ‘*’ to indicate that the validation of this part failed.

validation_styles_failed

This is a space-separated list of failed validation rules.

validation_styles

This is a space-separated list of configured validation rules.

<…>

Any part parameter can be used in the template. Depending on the part implementation the parameter is modified, interpolated, or kept as is.

Examples of Predefined Templates

These are taken from the LogicNets Assessment Framework.
 

Set a Custom Part Template in a Framework

You can set a custom part template in a framework by creating a logicnet in the onstart folder and using the set data object part in a process node to ensure the system loads the template when initializing the application. When you do this, set No Interpolate = YES.
When creating a custom part template, you can use one of the following approaches:

Approach A: Create New Template Definitions and Reference them in Nodes/Parts

At the start of application development, you can define new templates and reference them either on the Style tab for form part templates or the Details tab for node templates. This maintains standard LogicNets templates but adds to the library of templates the application uses to display information.

Approach B: Change Existing Template Definitions

This approach makes sense when you have built applications using standard LogicNets templates but want to add new/updated styling later in the application development cycle. Instead of editing every existing node to reference a new template, you can overwrite the standard definition by reusing the same name for the template but specifying an alternative DIV structure.

 

Use a Part Template

  • Define a template, for example:
    $(caption)
    $(control)
  • Update the part parameter, using one of two options:
    • Define the template directly in the part declaration.
      { template = “
      $(caption)
      $(control)
      ”, … }
    • Store the template in a context variable.
      { template_ref = “part_template”, … }

Use a Node Template

With node templates it is possible to mix the output of different parts of that node.

  • Define a template, for example:
    { template_ref = “part_template”, … }
  • Update the node parameters, using one of two options:
    • Define the template directly in node declaration.
      node = { template = “$(parts[1].caption)
      $(parts[1].control)$(parts[2].control)
      ”, … }
    • Store the template in a context variable.
      node = { template_ref = “node_template”, … }
Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 6 mths agoLast active
  • 13Views
  • 2 Following

Home