Setting data field value on hidden field when submitting form.

I have a field, that I want it to be hidden, but still send data onwards after submitting a form. I've tried various different things directly in $form on the field in question, but simply can't get it to work. I can set a value, but the field does not get passed onwards. The only workaround I found was to set value directly in class through boot() function:

public static function boot()
    {
        parent::boot();

        static::creating(function ($profileFeedback) {
              $profileFeedback->account_id = Filament::getTenant()->id;
        });

        static::updating(function ($profileFeedback) {
            $profileFeedback->account_id = Filament::getTenant()->id;
        });
    }


However, when I try to do any of the below given combinations, I just can't get it to work, any ideas?

 Forms\Components\TextInput::make('account_id')
                                            ->required()
                                            ->hidden()
//                                            ->dehydrateStateUsing(fn ($set) => $set('account_id', Filament::getTenant()->id))
//                                            ->reactive()
//                                            ->visible(false)
//                                            ->dehydrated()
//                                            ->afterStateHydrated(function ($set) {
//                                                $set('account_id', Filament::getTenant()->id);
//                                            })
//                                            ->afterStateUpdated(function (Closure $set) {
//                                                $set('account_id', Filament::getTenant()->id);
//                                            })
//                                            ->visible(false)
//                                            ->default(Filament::getTenant()->id)
                                    ])


Field simply doesn't get passed in any way.
image.png
Was this page helpful?