Hide form field in relation manager create modal
I am reusing a resource's form in a relation manager (e.g.
return UserResource::form($form)
) and I want to hide a field when the form is being rendered in the relation manager modal, but not in the normal create user page. I can't find any way to do that using the visible
function, the operation is create
in both views. any tips?2 Replies
I'm listing a Team's users and when you create a user through the relation manager the team_id gets set automatically, so I don't want to show the select field when you're creating a user through the modal.
Problem solved, you can use
hiddenOn
with the Relation manager class on your field, see 2:23 in this video: https://www.youtube.com/watch?v=gHKin-a7mPYFilament Daily
YouTube
Filament Re-Use The Form in Relation Manager
An example of the form used in the resource and in the relation manager, with a slight tweak.
- Filament Examples: Asset Stock Management https://filamentexamples.com/project/asset-stock-management
- More Filament examples on our website: https://filamentexamples.com