Conditional Fields
Show or Hide fields when conditions are metGeoDirectory version 2.1.1.0 introduces a new, highly anticipated feature:
Conditional Logic for Custom Fields
This new feature allows you to create dependencies between fields, based on the conditions that you set.
Dependent fields will only be displayed and editable, if the input entered on the fields they depend on, matches the right conditions.
This feature is fundamental for business directory listings, with many custom fields making it possible to select preset fields only when these apply.
An easy-to-understand example is represented by custom fields for Car Classified Listings.
Presumably, you will have a field labeled “Brand”, where users will select their car manufacturers such as Ford, GMC, or Lamborghini.
And you will have a field labeled “Models“, where you select the model of the selected Brand of cars. If you select Ford, this field will display models such as C-Max, Fiesta, Focus, Fusion, Mustang, and so on.
If you select Lamborghini, this field will display models such as Huracan, Aventador, Gallardo, Murcielago, Diablo, and so on.
To create this example, we added 3 custom fields to our setup. Brands, Ford Models, and Lamborghini Models.
On the Ford Models Field, we set the condition to show only when you select the Ford option in the Brands field.
On the Lamborghini Models Field, we set the condition to show only when you select the Lamborghini option in the Brands field.
It is as easy as that.
Another case in point would be Real Estate Listing.
Let’s show a full tutorial, including how to set up the fields, using our WordPress Real Estate Theme.
Conditional Fields for Real Estate Listings
Our Real Estate listing demo includes a field labeled Property Type with options such as Houses, Apartments, and Land and another field asking for furnished/unfurnished status. Obviously, the second field never applies to Land properties.
In this case, we will add a Conditional Logic to the Furnishing select custom field by doing the following:
1. Open the Furnishing Select Field.
2. Click the “+ Conditional Field” link at the lower-left corner of the custom field options.
3 After clicking on it, a new set of options will appear.
4 For our example, we will need to set them as follows:
- ACTION = HIDE
- FIELD = Property Type
- CONDITION = equals to
- VALUE = Land
and save the custom field. Below you can see what this will look like.
After doing that, this is the result on the Front End:
The same conditions can be added to other fields like the bedrooms or bathrooms fields, which are not needed if you are listing a piece of land.
You can also add multiple conditions if you need to do so.
The available options are:
- ACTION = SHOW/HIDE
- FIELD = All your fields
- CONDITION = empty, not empty, equals to, not equals, greater than, less then, contains.
- VALUE = accept text
And you can add as many as you wish for each field.
What are you going to build with GeoDirectory conditional custom fields?
Let us know in the comment down below…
Newsletter - Stay Updated!
Get the latest news, tips, and exclusive content directly in your inbox.