The principle of conditional fields is simple - when editing a custom field, you can specify a dependency when that field is displayed. The chosen custom field will appear only if a specific value is selected in another custom field.
Conditional fields can be used in Category, Contact, Profile, and Ask Seller Form ( so wherever this setting is possible when creating a new custom field.)
Conditional fields App
This feature works thanks to the “DJ-Classifieds - Conditional Fields” app that needs to be installed separately. This app is purposed for adding conditional fields functionality The package installation process is the same as any other Joomla extension installation.
The conditional fields App is free to download for all active DJ-Classifieds extension subscribers.
After successful installation, navigate to "Extensions -> Plugins -> DJ-Classifieds -Conditional Fields" and enable the plugin.
After switching on, a new tab “Conditional fields” will appear in the newly created or edited field:
- Trigger field - select the custom field that will cause this field to show up (after providing the value/values specified below)
- Trigger value - specify the value/values of the trigger field that will cause this field to show up.
For users posting an advert with the "used" items, we will add the new extra field allowing the user to choose the item's condition (good/bad).
This means that if the user selects that the item is used when placing an advertisement, an additional field will appear in which he can specify whether the condition of the item in the advertisement is good or bad.
Open your DJ-Classifieds control panel and navigate to "Fields". Click "new" to create a new field.
Let’s start with the custom field with Used/New values. See the example settings (marked fields are important for this effect):
The next step is a new custom field with Good/Bad values. See the example settings below:
Additionally, it is required to configure the “Conditional fields” tab here. It’s because we need to specify the condition to happen.
Now, after that configuration, when the user posts and advert and choose the "Used" as the condition, the new extra field will appear with "Good" and "Bad" options to select.
The final effect
Conditional fields work in the submission form (when adding an advert) and in the Search/Filters module.
See the final effect in the Advert Submission form:
See the final effect in Search & Filter module: