We used cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. What For?

« Back to Blogs

Liferay DXP Forms - REST Data Provider

A form is one of the basic needs for almost every organization. We might need to create simple or complex forms based on requirement. Sometimes it becomes time-consuming to create complex/multi-part forms. With the new iteration of Liferay DXP, we can create different types of forms using DXP Forms feature. It comes with advanced features which allow us to create basic to complex/multi-part forms without any knowledge of coding whatsoever. It is much like adding content to the page.


Basic knowledge of Liferay and DXP Forms.

It’s really easy to create simple forms with the Forms Application. You can reach this in the Menu by using the site selector to choose the site you want to work in and clicking Forms under the site. Once you are in the Forms App, click the Add button. You are taken to a screen where you can create a form. To meet your form-building needs, Liferay Forms provide useful and highly configurable field types.

Liferay’s built-in Forms application supports most basic form building needs (something like a one question survey), and also most advanced (like a mortgage application, or conference sign-up form) which are listed below.

  • Populating a Select field with a REST Data Provider

  • Multi-Page Forms

  • Wizard Mode for easier navigation

  • Enabling workflow for the form

  • Placeholder text and predefined values in form input fields

  • Validating fields using a number of different criteria

  • Configuring form permissions

  • Field Visibility Control

  • CAPTCHA in Form

  • Redirecting to a different URL after a successful form submission

  • Sending an email notification whenever a form entry is submitted

I’ll be explaining how we can use the “Populating a select field with a REST data provider” feature.


Populating Select Fields With REST Data Providers

Adding and Configuring a Data Provider

Before using a Data Provider in your select fields, you need to configure one which you can use in your forms. Navigate to the Forms application in Site Administration ? Content ? Forms, and click the Option button.



Click on Data Providers, the data providers window opens, and you can see any existing data providers or add a new one. Click the Add button.



Fill out the Data Providers form, passing in the following values:

  • Name: Countries List

  • Description: A complete list of earth’s countries

  • URL: http://localhost:8080/api/jsonws/country/get-countries

  • Displayed JSON Attribute: nameCurrentValue

  • Stored JSON Attribute: name

  • User Name: [email protected] (replace with username)

  • Password: user_password (replace with user password)


Using a Data Provider in a Select Field

To use data provider in selection field, edit select field and select “From Data Provider” under Create List option. Choose your data provider from the list.



Your Data Provider is now being used to populate your select fields. You can use your data provider in form’s selection field as rest provider.



You may also want to configure permission for data provider as per your business needs.

That's It. Your Data Provider is now being used to populate your select fields.

contact-us Request a callback WhatsApp