© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Andrew Wallo

How do I disable the Auto-saving of Form field relationships?

I currently have a form similar to the following:

public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\Section::make('General')
                ->schema([
                    Forms\Components\Select::make('account_id')
                        ->label('Account')
                        ->relationship('account', 'name')
                        ->searchable()
                        ->preload()
                        ->nullable(),
                    Forms\Components\Select::make('currency_code')
                        ->label('Currency')
                        ->relationship('currency', 'code')
                        ->searchable()
                        ->preload()
                        ->nullable(),
                ])->columns(),
            // More fields...
        ]);
}
public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\Section::make('General')
                ->schema([
                    Forms\Components\Select::make('account_id')
                        ->label('Account')
                        ->relationship('account', 'name')
                        ->searchable()
                        ->preload()
                        ->nullable(),
                    Forms\Components\Select::make('currency_code')
                        ->label('Currency')
                        ->relationship('currency', 'code')
                        ->searchable()
                        ->preload()
                        ->nullable(),
                ])->columns(),
            // More fields...
        ]);
}


The entire form has around 8 fields that all have a relationship. The only issue is that it is absolutely necessary that I use the
handleRecordUpdate()
handleRecordUpdate()
method to further handle the data and record being saved. I honestly think that it should be mentioned in the documentation that Filament will automatically save the data before you can handle it any further within the
handleRecordUpdate()
handleRecordUpdate()
method since this may cause Users confusion.

But anyways, is there a way to disable the auto saving of relationships for the entire form?

I am aware that I could do this for each field:
Forms\Components\Select::make('currency_code')
    ->label('Currency')
    ->relationship('currency', 'code')
    ->saveRelationshipsUsing(null) // Here
    ->searchable()
    ->preload()
    ->nullable(),
Forms\Components\Select::make('currency_code')
    ->label('Currency')
    ->relationship('currency', 'code')
    ->saveRelationshipsUsing(null) // Here
    ->searchable()
    ->preload()
    ->nullable(),


But I find this a little exhaustive.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How do I test the Managing relationships form
FilamentFFilament / ❓┊help
2y ago
Saving relationships
FilamentFFilament / ❓┊help
11mo ago
How Can I Stop the Relationship from Auto-Saving After Submitting the Form
FilamentFFilament / ❓┊help
2y ago
How do form fields with relationships work?
FilamentFFilament / ❓┊help
2y ago