Legacy Knowledge Base
Published Jun. 30, 2025

How to display form entries data which is submitted through form in user interface?

Written By

Koustuv Dhani

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

  • Is there any way to view form entries in a grid format by clicking a button labeled "View Form Entries." ?

Environment

  • Liferay DXP 7.2

Resolution

  • In Liferay DXP 7.2, the functionality to display form results in a grid format is unavailable. This feature was introduced in Liferay DXP 7.3 and later versions.

  • However, a workaround can be implemented to achieve this functionality in Liferay DXP 7.2 using the Liferay Page Fragment and Headless Form API.

NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.

Creating a Liferay Page Fragment:

  •  Liferay Page Fragment is used to add a customizable UI component to the page where form entries need to be displayed.

  • Navigate to Site Builder > Fragments > Collections and add a new fragment and name it "View Form Entries."

  • Inside the fragment add a button labeled "View Form Entries." This button will trigger the API call to fetch form data.

  • Now use the Liferay Headless Form API to retrieve form entries. To fetch form entries, use the following Liferay Headless Form API Endpoint:

    • GET /o/headless-form/v1.0/forms/{formId}/form-records
  • Replace {formId} with the actual form ID. Configure CORS in Liferay to allow API calls from the fragment.

  • Use the following JavaScript snippet to fetch and display the form entries.

  • This API request returns the following data based on the provided form ID(EntryiD, status, field data, creator, Date of creation).
  • Change the formId and the InnerHtml in the fragment as per your requirement.
  • Use the following JavaScript snippet to fetch and display the form entries:

    • const viewEntriesButton = document.getElementById('viewEntriesButton');
      const formEntriesContainer = document.getElementById('formEntriesContainer');

      viewEntriesButton.addEventListener('click', async () => {
      const formId = 'your_form_id';
      const apiUrl = `/o/headless-form/v1.0/forms/${formId}/form-records`;

      try {
      const response = await fetch(apiUrl, {
      headers: {
      'Authorization': 'Basic ' + btoa('test@liferay.com:test'),
      'Content-Type': 'application/json'
      }
      });

      if (!response.ok) {
      throw new Error('Failed to fetch form entries');
      }
      const data = await response.json();

      } catch (error) {
      console.error('Error fetching form entries:', error);
      }
      });
  • Now deploy the fragment to the desired page.
  • Click the "View Form Entries" button to fetch and display the form entries.
  • Verify that the form entries are displayed correctly.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base