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:
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
Click the Rules tab.
Click the Add () button.
Select Reward from the If Condition.
Create the rule: Is equal to → Value → All expenses paid trip.
Select Autofill from the Do Action selector.
Select the data provider from the From Data Provider selector.
Select Region from the Region selector.
Select Country from the Country selector.
Click Save when finished.
Publish the form.
Navigate to the Site where the form is displayed.
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.
Users can now search for a region then the countries in the form.