Using the Autofill Rule

The autofill rule filters a form field’s options based on pre-configured conditions. If you already have a data provider enabled, the autofill rule is the next step in enhancing your form. See Using the REST Data Provider to Populate Form Options to learn more.

The sample form below asks the respondent to select either a cash reward or a vacation. If the respondent selects the latter, she must then choose the geographical region and then a country. The form uses an autofill rule to filter countries based on a geographic region.

Follow the steps below:

  1. Configure a data provider which imports the countries of the world with regional filters.

  2. Create a form with these fields:

    • A Single Select field called Rewards with two options: Cash or All expenses paid trip
    • A Text field called Region
    • A Select from List field called Choose a Destination Country that uses the restcountries.com data provider

Configuring the Autofill Rule

  1. Click the Rules tab.

  2. Click the Add (Add) button.

  3. Select Reward from the If Condition.

  4. Create the rule: Is equal toValueAll expenses paid trip.

  5. Select Autofill from the Do Action selector.

  6. Select the data provider from the From Data Provider selector.

  7. Select Region from the Region selector.

  8. Select Country from the Country selector.

    Create the autofill rule.

  9. Click Save when finished.

Verifying the Autofill Rule

  1. Publish the form.

  2. Navigate to the Site where the form is displayed.

  3. Enter a valid region into the Region field and observe that the options in the Select from List Field are filtered based on the Region. The <restcountries.com> service has these regions: Africa, Americas, Asia, Europe, Oceania, and Arctic.

    Filter countries by region of the world.

Users can now search for a region then the countries in the form.

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy