WordPress Lookup Fields
After several months of working on version 2.01.0, a juicy new field type has been added to the menu: WordPress Lookup Fields.
The idea for this new field type came as a result of working directly with many of you in support. I saw a need for dynamic field options and values that our "Dynamic" field type didn't completely fill. There were several times I simply had to say "Sorry, this can't be done". There were other times where I would tell people they could achieve the dynamic relationship they needed, but it would require hours of tedious setup.
Eventually an idea formed that I realized would make complex relationships possible without hours of setup and without a giant headache. This is where Lookup Fields were born. I created Lookup Fields with you in mind. I looked at countless support topics to get an idea of the situations that needed to be addressed. My hope is that Lookup Fields will allow you to build the forms that you need with ease.
So, what do WordPress Lookup Fields do? Well, they do a lot. Essentially they are useful in the following five scenarios.
Dynamic radio or dropdown options
Lookup fields get their options from submitted entries so you can easily create dynamic field options.
Wait, Dynamic fields already do this...right? The short answer is yes, Dynamic fields do this. The long answer is that Dynamic fields store an entry ID which is very useful in some situations, but it's also confusing and unnecessary if that's not what you want.
Lookup fields are plain and simple. They store the value exactly as you see it in the option. Also, Lookup fields automatically remove duplicates and they have an "Order" setting, intended to make your job easier. Checkboxes and multi-select dropdowns will be added to the Lookup field options shortly.
Yes, this is something Dynamic fields can do too, but it's also what originally sparked the idea for Lookup fields. In order to set up a three level dependency (like Country/State/City or Year/Make/Model relationship) with Dynamic fields, three forms are required and three CSV imports (or thousands of manual entries). With Lookup fields, you can set up this type of dependent relationship with one form and one CSV import. This can save you a lot of time messing with data. Read more about setting up a cascading relationship.
Drill down to a final cost
A lot of the times, using separate values is perfect for calculating a total cost. However, there are times when the value for an option changes depending on other options. For example, if you're selling insurance policies and the final price is determined by the selected company and state combination, you can use Lookup fields for this. After the company and state is selected, a text or number field will display the price. Read more about this here.
Select a value and populate fields
Make it easier for users to fill out forms if they've already submitted similar data. They can select a previously submitted entry from a dropdown field and voilà - the fields in the form are automagically populated with values from the selected entry. Read more about setting this up here.
This automatic population is currently limited to dropdown fields and text fields (and variations of text fields). This option will be added to more field types very soon.
Retrieve a value by searching
This is similar to #4, but the difference is that the value must be searched instead of selected. This is useful if you don't want the options to be visible to everyone. For example, maybe you want users to enter their email address and then a code appears in another field. Read more about setting this up here.
So, what's next for Lookup fields? There are three main features that are "in the works" for Lookup fields at this time.
- Checkboxes and multi-select dropdowns
We will be adding a checkbox and multi-select dropdown setting to Lookup fields in coming releases.
A Lookup > Image option will be added so it's easy to display image files from submitted entries.
- Populating all field types
Currently, it's possible to use Lookup fields to automatically populate dropdown fields and fields with a text input. We will be adding the option to populate all field types.
These are the top three features that I'll be adding to Lookup fields in the coming months. Keep an eye out for them, and of course, let me know if you have any questions or suggestions.
If you would like to see what other changes 2.01.0 includes, take a look at our changelog.