Low-Code Designer > Widgets > Widget Types / Code Widget

Code Widget

The Code widget allows you to add HTML code to a form that is dynamically generated using special syntax constructions.

mceclip0.png

Syntax constructions

In this widget you can use syntax constructions of 3 types:

  • <% Constructions, declarations %>. See the examples below.
  • <%- Escaping of HTML characters %>. For example, if the value is preceded by the "<" sign, it will be represented as "<".
  • <%= Unescaping of HTML characters %>. For example, is the value is "<b>Attention!</b>",  the displayed text will be Attention (in bold).

Let's have a look at the synax constractions of the first type:

Conditions

<% if (data.Value > 10) { %>

Content that you want to display.

<% } %>

Loops

<% for (const item of data.items) { %>

Content that you want to display.

<% } %>

Decalartions (foe example, function)

<% function renderValueInTag(value, tag) { %>

<<%= tag %>>

<%- value %>

</<%= tag %>>

<% } %>