Add International Dial Codes to Your Formidable Forms

How to Use a Lookup Table

Screen capture image of developers directory registration form section showing international dial code and phone number

Introduction

Image of diverse global community standing in front of colorful globe. Image downloaded from pixabay.com.

The Masterminds Developers Directory attracts Formidable Forms developers from all across the World. Since it's important to have Developer contact details in each directory listing, we added an International Dial Code lookup feature to the Developers Directory Registration form.

The lookup form, along with its 252 entries, is available as a free download from here: International Dial Code Form.

The form has 4-fields. They are:

  1. Country
  2. ISO Code (2-character)
  3. International Dialing Code
  4. User ID

The country 2-character ISO Code is part of this form for one reason, did you ever populate a dropdown with Formidable's default Countries list with the bulk edit feature? The list is purely country names, which is fine to satisfy most system requirements.

Sometimes however, a requirement comes through where a project needs the country ISO Code. The International Dial Code content can help because it can be difficult to create your own bulk edit file that uses separate values when the label and value come from two different places.

The balance of this article explains the various methods you can use with a lookup form like the International Dial Code Form. These methods will work with any Formidable form you create to use as a lookup table.

This article makes two assumptions about your development environment:

  1. You may have already downloaded the zip file, expanded it, and imported the form and its entries into Formidable.
  2. Or, you may have created your own form with content you'd like to use as a lookup form.

Either way works with this article. It's generic enough to work with any lookup table form, but primarily instructs how you can use the International Dial Code lookup table yourself.

Using with Your Form

About Lookup Tables

Lookup tables have been around since the discovery of computational math. Before computers, lookup tables of values were used to speed up hand calculations of complex functions, such as in trigonometry, logarithms, and statistical density functions.

In software development, lookup tables are useful in a variety of operations and Formidable makes it a breeze to use them. Lookup tables figure prominently when building a Workflow Engine for a Formidable project, and even more so if the workflow has a complex security structure with HR and Active Directory integration such as may be required in a DEX Intranet project.

Even today, as the WordPress environment moves more and more toward JSON driven theme configurations and blocks, lookup tables will always have a place in data driven design where a great transactional data management tool like Formidable is part of your success formula.

The simplest type of lookup table uses just two fields. First create a field that can be used as the future lookup field's label and another field in this form that can be used as the future lookup field's value. You can also use both fields independently in their own select fields.

And in the future, if you choose to include a dynamic field in a form design, the value is the lookup table's entry_id for the selected value. Storing the entry_id instead of the actual value allows you to display any lookup table field from that entry, even if it's not the one you used in the lookup field in the first place when the entry was made.

Here's the preview of a basic lookup table:

Beyond Basic

Lookup tables can have many uses. Did you know lookup tables can be used to handle the dynamic configuration of specialized system features?

A project we did for a client required a dynamically configured ChartJS graph. It was a dynamically changing graph linked to Formidable form values displayed in a dropdown. They wanted the chart built to display 5 dimensions today, but flexible enough to add a sixth dimension if they decided to increase their offered options.

Using a lookup table we created a data driven system that allowed them to add up to 5 additional dimensions. Each dimension had a field for the rgb color code that is used dynamically in creating the CSS that drives the chart colors. The use of lookup tables is limited only by the imagination and the skill of the developer.

The International Dial Code form is a little more than the basic because it uses four fields:

Screen capture image of dial code fields from form builder page

Lookup Field Types

Lookup tables can be used to populate two Formidable lookup field types: Lookup and Dynamic. Do you know the difference?

The best source for learning the difference is Formidable's knowledge base: Dynamic vs. Lookup Fields.

Make Your Selection

If the distinctions between Formidable's Dynamic vs. Lookup Fields are clear, which lookup field type would you choose as your form design selection?

The answer may be in these next questions:

  • What are your long term goals for this data element?
  • When a user creates an entry in the form you are designing, do you need to store the entry_id of the lookup record or the lookup field's actual value?

Please be mindful of the distinctions.

Lookup Field Setup

The best place to learn about setting up a Static or Dynamic Lookup field on your form is the Formidable Knowledge base. For Static Lookup fields, see https://formidableforms.com/knowledgebase/lookup/; and for Dynamic Lookup fields see https://formidableforms.com/knowledgebase/dynamic/

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *