Dynamic Drop Down Population

Dynamic Drop Down Population

I have found this useful and assume others will as well. For this activity, I have a form that allows the user to select a sport, which is a lookup field to my sports form. Once a sport is selected, I have two drop down fields that are for event types and location. These 2 fields will be populated based on the sport selection, by getting the record of the sport and then checking for the event types and locations registered to that sport. The code is as follows:

  • // create empty collections to hold the fetched data
  • locations = Collection();
  • event_types = Collection();
  • //make sure that a sport value is selected
  • if(Team.Team_Name != null || Team.Team_Name != "")
  • {
  • // fetch the data for the sport
  • sport_data = Sports[Sport_Name == input.Team.Sports.Sport_Name];
  • if(sport_data.count() > 0)
  • {
  • //start filling our event collection variable
  • for each  event in sport_data.Event_Types
  • {
  • event_types.insert(event.Event_Type);
  • }
  • //start filling our event location collection
  • for each  location in sport_data.Locations
  • {
  • locations.insert(location.Location);
  • }
  • }
  • //add all of our collections to their respective drop downs
  • input.Event:ui.add(event_types);
  • input.Location:ui.add(locations);
  • }

    • Access your files securely from anywhere

          Zoho Developer Community




                                    Zoho Desk Resources

                                    • Desk Community Learning Series


                                    • Digest


                                    • Functions


                                    • Meetups


                                    • Kbase


                                    • Resources


                                    • Glossary


                                    • Desk Marketplace


                                    • MVP Corner


                                    • Word of the Day



                                        Zoho Marketing Automation


                                                Manage your brands on social media



                                                      Zoho TeamInbox Resources

                                                        Zoho DataPrep Resources



                                                          Zoho CRM Plus Resources

                                                            Zoho Books Resources


                                                              Zoho Subscriptions Resources

                                                                Zoho Projects Resources


                                                                  Zoho Sprints Resources


                                                                    Qntrl Resources


                                                                      Zoho Creator Resources



                                                                          Zoho Campaigns Resources


                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now