LogoLogo
Getting StartedDevelopersDeployment GuideGet Help
  • Quick Links
  • Welcome to Form.io
    • Getting Started With Form.io
    • Launch a Form
    • Overview of Form.io
  • Developer Tool Ecosystem
    • PDF Solution
    • Enterprise Form Builder
    • Form View Pro
    • The Security Module
    • Accessibility Compliance Module
    • Developer License
    • SQL Connector - Deprecated
    • Integration Libraries
    • Form.io CLI Tool
  • User Guide
    • Introduction
    • Form.io Developer Portal
    • Teams
    • Projects
      • Project UI
      • Project Settings
      • Stages
      • Multi-Tenancy
    • Resources
      • ResourceJS
    • Forms
      • Form Creation
      • Form Types
      • PDF Forms
      • Embedding a Form
      • Form Revisions
      • Form Settings
    • Form Building
      • Form Builder UI
      • Form Components
        • Component Settings
        • Basic Components
          • Resource as Select Component Data Source
        • Advanced Components
        • Layout Components
        • Data Components
        • Premium Components
          • Nested Forms
        • Custom Components
      • Logic & Conditions
      • Existing Resource Fields
      • Actions
    • Submissions
      • Accessing Submissions
      • Importing Submissions
    • Form.io eSignature - Coming Soon
    • Form.io Reporting Module
    • PDF Template Designer
    • Form View Pro
    • Form Manager
    • Enterprise Form Builder Module
      • Installation
      • User Guide
  • Developer Guide
    • Introduction
      • Application Development
      • API Documentation
    • Form Development
      • Form Renderer
      • Form Builder
      • Form Embedding
      • Form Evaluations
      • Form Templates
      • Custom Components
      • Translations
    • JavaScript Development
      • JavaScript SDK
      • JavaScript Frameworks
      • JavaScript Utilities
    • Authentication and Authorization
      • SAML
      • OAuth
      • LDAP
      • Resource Based Authentication
      • Email Authentication
      • Two-Factor Authentication
    • Roles and Permissions
      • Field Match-Based Access
      • Field-Based Resource Access
      • Group Permissions
    • Integrations
      • Email Integrations
      • File Storage
      • Google Developer Console
      • eSign Integrations
      • Relational Databases
    • Modules
    • Fetch Plugin API
    • CSS Frameworks
    • Offline Mode
    • Audit Logging
  • Deployments
    • Self-Hosted Deployment
      • Local Deployment
        • Local File Storage
      • Kubernetes
      • Cloud Deployment
        • AWS Deployment
          • AWS Lambda
          • Form.io/AWS Elastic Beanstalk End-To-End Encrypted Deployment
        • Azure Deployment
          • Azure App Service
            • Azure MSSQL Connector - Deprecated
          • Azure Virtual Machine
          • Azure Kubernetes Service
          • Set up the DB
        • GCP Deployment
          • GCP Cloud Run
      • On-Premise Deployment
      • Enterprise Server
      • PDF Server
    • Deployment Configurations
      • DNS Configuration
      • Load Balancer Configuration
    • Licenses
      • License Management
      • Library Licenses
    • Portal Base Project
      • Portal SSO
      • Portal Translations
    • Maintenance and Migration
      • Changes to Premium Libraries
  • FAQ
    • FAQ
    • Tutorials & Workflows
      • Password Reset
      • Dynamic Select Filtering
      • Approval Workflow
      • SSO Email Token
      • Embedding A Video
      • Data Source Validation
      • Select Data Source Options
      • Nested Form Workflows
        • Nested Wizard Forms
      • Save as Draft
      • Role-Based Conditions
      • Custom Component
      • Dynamic Radio and Select Box Values
      • Override CKEDITOR
    • Errors
    • Examples
    • License Utilization Checks
  • Contact Us
Powered by GitBook
On this page
  • Vehicle Make Resource
  • Establish the Vehicle Make Database
  • Vehicle Model Resource
  • Make Resource Reference
  • Establish the Model Database
  • Create a Vehicle Registration Form
  • Make and Model Reference
  • Adding Filter Query and Setting Refresh Options
  • Testing The Form

Was this helpful?

  1. FAQ
  2. Tutorials & Workflows

Dynamic Select Filtering

PreviousPassword ResetNextApproval Workflow

Last updated 3 months ago

Was this helpful?

Many users utilize the Select component within their form to reference resource data stored within their project. This has several benefits which we have covered in previous . In addition to data reference, users may also need the ability to dynamically filter a Select dropdown based on the selection of another Select dropdown.

For this demonstration, we will be creating a Vehicle Registration system. It will take into account a vehicle’s year, make, and model where the model field is dynamically updated based on the make vehicle value selection.

Vehicle Make Resource

  1. Within a project, create your first Resource calledVehicle Make. This will be the initial resource that will trigger the filtering.

  2. Drag and drop a Text Field component called Make Resource. Within the component settings, click the API tab and take note of the Property Name makeResource.

Establish the Vehicle Make Database

  1. Click the Use tab of the Resource and create a database by submitting two entries: Ford, Chevy.

  2. After making the submissions, click on the Data tab and ensure you see the submissions within the data table.

Vehicle Model Resource

  1. Next, create a new Resource called Vehicle Model.

  2. Add a Select component called Make Reference and a Text Field component called Model Resource.

Make Resource Reference

Next, we are going to configure the Select component to reference the Make Resource data we generated in the previous step.

  1. Open the Select Component settings and click the Data tab. Set the Data Source Type to Resource

  2. Set the Resource dropdown to Make Resource.

  3. Set the Value Property field to Make Resource.

This will ensure the Select component references the Make Resource field data from the Vehicle Make resource.

Establish the Model Database

With our Make reference in place, we can now tie together the Models with their respective Make.

  1. Click the Use tab for the Vehicle Model Resource.

  2. Click the Make dropdown to select Chevy, and input a Chevy model in the Model Text Field.

  3. Make 3 submissions using the Chevy make. e.g.:

Chevy Camaro, Chevy Equinox, Chevy Silverado

  1. Make 3 submissions using the Ford make e.g.:

Ford Mustang, Ford Escape, Ford F-150

Create a Vehicle Registration Form

Now that we have our database and references established we need a Form to register our vehicles.

1 Click the Forms tab and create a new Form called Vehicle Registration.

2 Add two Select Components called Make and Model and a Text Field Component called Year.

Make and Model Reference

  1. Open the Make component settings and set the Data Source Type to Resource

  2. Set the Resource field to Vehicle Make

  3. Set the Value Property to Make Resource.

  1. Open the Model component settings. Similarly, set the Data Source Type to Resource

  2. Set the Resource field to Vehicle Model

  3. Set the Value Property to Model Resource.

If we click Use for the form in this state, both select dropdowns populate with their respective values. However, the Model field isn’t filtering against the Make field, which doesn't help us with the filtering we are trying to achieve.

Adding Filter Query and Setting Refresh Options

To fix this, we need to make some configurations to the Model component.

  1. Open the settings for the Model Select Component. Within the Data tab, scroll down to the Filter Query field which will handle the logic to remove certain Model values when a Make is selected. Add the following query below which equates the value of the Model Resource Make Reference component against the value of the forms Make Select Component:

data.makeReference={{data.make}}
  1. Within the Data settings tab, scroll down to the Refresh Options On field and select the Make field. This will ensure the Model values update anytime a change is made to the Make field.

  2. Finally, check the Clear Value On Refresh Options to ensure any set value on the Model field is cleared when a new Make value is selected.

Testing The Form

With these changes in place, Use the Vehicle Registration form and select a Make value. The values within the Model field should reflect Models associated with that Make. Changing the Make field should clear the selected Model value and refresh the options to the new Make Models.

This is the as the Make Select Component that we set up in the Model Resource.

same workflow
documentation