Do hidden fields get processed?
Hi guys - I have a "user_id" field in a form. I want this value to be set to the current user, and the field should be hidden from view. Only admins should be able to see and edit this field.
If I hide the field from non-admins, will the default still be set (it's a required field)?
Forms\Components\Select::make('user_id')
->relationship('user', 'name')
->searchable()
->preload()
->placeholder('Select user')
->required(),
Solution:Jump to solution
no, but you can customize this process
https://filamentphp.com/docs/2.x/admin/resources/creating-records#customizing-data-before-saving...
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
4 Replies
something like this?
will it use the default value if its hidden?
->default(auth()->user()->id)
Solution
no, but you can customize this process
https://filamentphp.com/docs/2.x/admin/resources/creating-records#customizing-data-before-saving
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
ah, thank you