PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Show extra settings based on another setting option

Solved
mikemastercorp

Aug 21st, 2022 10:45 AM

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 :)

bobbyiliev

Aug 22nd, 2022 12:07 AM

Best Answer

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!

Report
1
mikemastercorp

Aug 25th, 2022 07:16 PM

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.