Why Are Hyperlinks Rendered as HTML Text After Upgrading to 17.0?

The Problem

If HTML text is displayed instead of a clickable hyperlink, the link is being sanitized by the UI component in which the <a> tag is used.

This usually happens when the link is not an internal link. For example, the URL is not on a secure pricefx.com or pricefx.eu domain, or it does not start with # for a context link.

The sections below explain how to render clickable hyperlinks with external URLs in specific UI components.

Master Tables or Company Parameters Grids

If hyperlinks are expected in a column, check the column type first. The column may be unset or configured with an unsupported type such as Text.

Solution: Set the column type to Link. Other column formats sanitize <a> tags.

Line Items Grids

If hyperlinks are expected in a line item grid column, check the format type of the logic element that populates the column. The format type may be unset or configured with an unsupported type such as Text.

Solution: Set the format type of the element to Link.

ResultMatrix Grids

The column, where hyperlinks are expected, was not configured to have the right format in Groovy. The format was either not set at all or was set to a type that should not support hyperlinks, such as FieldFormatType.TEXT.

Solution: set or change the column type to FieldFormatType.LINK via ResultMatrix.withColumnFormats(columnFormats) (javadoc) or via ResultMatrix.withColumnFormat(columnFormat) (javadoc)

InputMatrix Grids

If an InputMatrix input shows external hyperlinks as HTML text, the column is not of type Link. The Groovy logic of the InputMatrix sets no column type for the column, or sets another type, such as Text. In every column type, internal links stay clickable, and so do links to the Pricefx Confluence wiki (https://pricefx.atlassian.net/wiki).

Solution: From version 17.3, set columnType to Link for the column in the InputMatrix input builder. Define the columns as a list of maps with the keys columnName (mandatory), columnLabel and columnType. If the logic sets the column types with setConfigParameter("columnType", [...]), use Link in that list for the column.

Example:

Groovy
def inputMatrix = api.inputBuilderFactory()
        .createInputMatrix('The Matrix')
        .setColumns([
                [columnName: 'Desc', columnLabel: 'Description', columnType: 'Text'],
                [columnName: 'Url',  columnLabel: 'Link',        columnType: 'Link']
        ])
        .buildMap()

The keys are case-sensitive. A column map without columnName makes the input builder throw a MissingMandatoryColumnException. A column map with a key other than columnName, columnLabel or columnType makes it throw a ColumnStructureException.

Situation

Column type the InputMatrix uses

columnType is Text, Numeric, Money, Date, DateTime or Link. Upper or lower case does not matter.

The type that the value names.

The logic sets no columnType, or a value that the InputMatrix does not recognize, such as a misspelled type. Pricefx shows no error.

Text.

The column has value options in columnValueOptions and the InputMatrix is editable.

Option. The columnType has no effect.

The InputMatrix is read-only.

The type that columnType names. The read-only InputMatrix ignores value options.

A Link column shows these cell values as hyperlinks:

  • An <a> tag, alone or in text.

  • A value that is only an http or https URL. It opens in a new tab.

  • A single URL token with #/, for example #/md/products or /app/#/md/products. It opens in a new tab.

In versions 17.0 to 17.2, the InputMatrix has no Link column type, and a columnType of Link gives a Text column. The Allowed HTML Tags and Attributes page states that Pricefx Support can restore the previous hyperlink behavior on request.

If a Link column still shows <a> tags as HTML text, a partition configuration can escape all HTML tags. Ask your administrator or Pricefx Support to check it.

Need further assistance?

Contact Pricefx support.