© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
2 replies
qcol

Dynamic number of select fields

Hi!

I have tables:
sets: id, name
groups: id, name
set_groups: id, group_id, set_id
elements: id, name, group_id

The user creates himself any sets and groups, and assigns elements to the groups. I would like to create a form such that when a set is selected, as many select fields are displayed as the set contains groups, so:

Set #1
a) group #1 (Select field with elements assigned to the group)
b) group #2 (as above)
c) group #4
d) group #8

Set #2
a) group #2
b) group #8
c) group #10

Set #3
a) group #2
b) group #8

So each set has a different number of different groups and so when Set#1 is selected 4 select fields should appear, when Set #2 is selected 3 select fields should appear and when Set #3 is selected only 2 select fields should appear. Finally, the user selects items from each group.

My first thought is to make, say, 10 fixed select fields for the groups and hide/unhide only as many as needed. However, I am afraid that the user will need more groups than 10, so the safest thing would be to use a FOR loop to build as many select fields as needed for a given set.
Can you give me a hint on the easiest way to do this?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Dynamic Select Fields
FilamentFFilament / ❓┊help
3y ago
Dynamic fields based on a select option
FilamentFFilament / ❓┊help
3y ago
Dynamic Fields Based on Select Option Issue
FilamentFFilament / ❓┊help
3y ago
Handling Dynamic Fields
FilamentFFilament / ❓┊help
5mo ago