Show extra settings based on another setting option
Hello mighty people.
I was wondering if it is possible (or how hard it could be) to have some settings inside the settings panel that would be dependent to show upon another setting.
Example would be: Show categories (checkbox) and if checked, to show another settings option (dropdown) to select among some data.
This would be really useful when we would like to extend the settings further to any dependent choice fields (radio, checkbox, dropdown select etc.) and it would allow to combine some settings options one with another to make a more robust and easy to access later in front/back-end values.
Any thoughts or experience to share? Or am I being too brave to dream :)
Hi there!
One quick way to do this is to just add a small JS check if a specific radio button is checked or not and hide / show the input field based on that.
Here is quick CodePen example:
The downside of that approach would be that this is going to be only a frontend validation.
You could instead actually have those buttons defined as profile fields and add some checks based on that, eg:
@if(profile_field('text_area', 'about'))
// Show some fields
@endif
Let me know if this helps or if I've missed anything!
















Hey Bobby, flawless assistance as usual. And yes, I was also thinking about defining some fiels and then checking inside the controller, I just need to modify a bit the settings view to add those.
Since WAVE is using Voyager as a backend admin panel, I've also found some repeater options that might serve the purpose and allow multiple setting values to be defined in an array over a single field, so thank you very much, I believe this covers my current needs and I shall get back to the drawing board to decide which options to show/hide and trigger and experiment a bit more.