Setting up a form with the auto-fill feature


  • I want to auto-fill another field depending on the value entered in a text field.


  • Liferay Portal 6.2, Liferay DXP 7.0, Liferay DXP 7.1


  • This can be achieved by combining "data providers" and "rules".
    As an example, here is a form that auto-fills a prefecture name from a zip code


1. Go to content > form

2. Add a form with any name (e.g.: Address)

3. Add two text fields, each with a label (e.g.:Postal code, Prefectures)

4. Save the form and return to the form selection screen

5. Select "Data Provider" from the top-right three-dot button

6. Add a data provider with the following settings

Name: Zipcloud
URL: Http:? //Zipcloud.Ibsnet.Co.Jp/api/search Zipcode ={zipcode}

label Zipcode
parameters Zipcode
type text box

label Prefecture
parameter $. results[0].address1
types text box

7. Return to the form selection screen and select "Address".

8. Go to the Rules tab and add a "Rule" with the following settings

If "Postal code" "is not empty"

Perform "Autofill" Data provider "zipcloud"

Data provider input:
zipcode "Postal code"

Data provider output:
prefecture "Prefectures"

9. Add the form portlet to one of the pages and select the form you have created

10. Enter your postal code in the "Postal code" field.

additional information

0 人中有 0 人觉得有帮助