F
Filament4mo ago
MZX

How to hide the field but still get the data

I have a submission date field, which i want to automatically be set to now, but i have hidden it, so now the input isn't being fetched when the form is submitted
Forms\Components\DateTimePicker::make('submission_date')
->hidden()
->default(now())
->dehydrated(),
Forms\Components\DateTimePicker::make('submission_date')
->hidden()
->default(now())
->dehydrated(),
3 Replies
trovster
trovster4mo ago
Alternatively, you can use mutateFormDataBeforeSave - https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-data-before-saving
$data['submission_date'] = now();
$data['submission_date'] = now();
MZX
MZXOP4mo ago
Thanks, the hidden field did it!
Want results from more Discord servers?
Add your server