Legacy Knowledge Base
Published Sep. 10, 2025

Cannot display user input field value in Web Content templates

Written By

Dia Seung

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • When using getData in Web Content template (see example code below), the field reference is displayed instead of the user input field value.  (Output: 'Option92682299' is displayed instead of user input value "Test Option")
    <#if (field1.getData())??>
    ${field1.getData()}
    </#if>
  •  When querying the ddmstructureversion table from database (see example script below), the value and the reference values are the same. 
    SELECT definition
    FROM `{database_name}`.`ddmstructureversion`
    WHERE structureID='xxxxx';

Environment

  • DXP 7.0, 7.1, 7.2, 7.3, 7.4

Resolution

  • Field Value matching the Field Reference when querying ddmstructureversion aligns with the current expected behavior, which is to save the Field Value, which is unique and initially has the same value as the Field Reference.  However, while the user can change the value of the Field Reference and the Label, the Field Value is immutable and that's why its value is stored in the database.  This is so that the field can still be found even if the Field Reference and Label change.
  • This intended change in data storage makes it necessary to update how to call the label in templates: one method would be to use getOptionsMap.
  • Here is an example of how to utilize getOptionsMap to correctly call the user selected Value:
    <#if (field1.getData())??>
    ${field1.getOptionsMap()[field1.getData()]}
    </#if>

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base