Streamlining User Choices with Dynamic Drop-Down Filtering

Introduction

Welcome to this user-friendly guide on how to filter options in drop-down menus based on selected values in the Empress platform. This feature, known as Dynamic Drop-Down Filtering, allows you to streamline user choices and ensure accurate data entry. This guide will walk you through how to implement this feature in a step-by-step manner, using an everyday business scenario for clarity.

Understanding Dynamic Drop-Down Filtering

Imagine you have two drop-down menus in a form: State and City. The State menu consists of two options: ‘Karnataka’ and ‘Maharashtra’. The City menu includes ‘Bangalore’, ‘Mysore’, ‘Mumbai’, and ‘Pune’.

In an ideal scenario, the City options should change based on the State selected. If ‘Karnataka’ is chosen, ‘Bangalore’ and ‘Mysore’ should appear in the City menu. If ‘Maharashtra’ is selected, ‘Mumbai’ and ‘Pune’ should be the options. This is exactly what Dynamic Drop-Down Filtering allows you to do.

How to Implement Dynamic Drop-Down Filtering

To achieve this, you will need to use a custom script in Empress. Don’t worry - you don’t need any coding knowledge for this. The script is straightforward and easy to apply. Here’s what it looks like:

frappe.ui.form.on("Lead", "state", function(frm) {
  if(frm.doc.state == "Karnataka")
  {
    set_field_options("city", ["Bangalore","Mysore"])
  }
  else if(frm.doc.state == "Maharashtra")
  {
    set_field_options("city", ["Mumbai","Pune"])
  }
  else if(frm.doc.state == "")
  {
    set_field_options("city", ["","Bangalore","Mysore","Mumbai","Pune"])
  }
});

This script is activated when the State field (on the “Lead” form) changes. Depending on the selected State, it modifies the options in the City field using the set_field_options() function.

The Impact of Dynamic Drop-Down Filtering on Your Business

Implementing Dynamic Drop-Down Filtering greatly enhances the user experience by making forms more intuitive and efficient to navigate. It reduces unnecessary clutter, helping users make appropriate selections based on preceding choices. This results in cleaner data entry and improved system usability - both of which are crucial for streamlined business operations.

In conclusion, the Dynamic Drop-Down Filtering feature in Empress is a powerful tool for businesses, providing a simple way to streamline data entry and improve user satisfaction. For further assistance or queries, please refer to our additional resources or contact our support team.