Conditional Field Population Based on Active Tab in Filament v3 User Resource.
I am working on a Filament v3 app and have a
UserResource
with three tabs: Super Admin
, Group Admin
, and Clinic Users
. Each tab contains its own set of fields. I want to ensure that when I create a user from the Clinic Users
tab, only the fields from that tab are populated, and the other fields are set to null. The same should apply to the other tabs as well. How can I achieve this in Filament v3?2 Replies
What do you mean with tabs in this context? Do you mean tabs on the tables https://filamentphp.com/docs/3.x/panels/resources/listing-records#using-tabs-to-filter-the-records ?
If yes, then you could use the current request
activeTab
value and change the target action/url of the CreateAction button based on it. Something like this:
Now when clicking on the new button, it will get you to the Create Page, but with the name of your Tab added to the url. Something like /users/create?newType=clinicUsers
And now you can work with this param in your form. For example.