© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Finn

Setting a default value for hidden fields

I have model which stores the user_id of the person who created each record. I don't want the user to see this field when interacting with the form - it should all happen behind the scenes.

The issue is that when I use:
Forms\Components\TextInput::make('user_id')
  ->default(auth()->user()->id)
  ->hidden(),
Forms\Components\TextInput::make('user_id')
  ->default(auth()->user()->id)
  ->hidden(),

I get an SQL error
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value
.
Anyone know a solution for 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

default value when hidden()
FilamentFFilament / ❓┊help
2y ago
Hidden fields
FilamentFFilament / ❓┊help
3y ago
Default value and reactive fields
FilamentFFilament / ❓┊help
3y ago
Include hidden fields
FilamentFFilament / ❓┊help
12mo ago