© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
24 replies
ico

Reactive field inside a dynamic generated schema Filament v3

I have a schema that is generated dynamicly like so based on a selected field
Section::make('AQL Report Form')
    ->schema([
        TextInput::make('limitCardNumber')
            ->label('Limit Card')
            ->disabled(true),
        TextInput::make('orderQuantity')
            ->label('Order Quantity')
            ->disabled(true),
        Select::make('stageId')
            ->options($this->stages)
            ->label('Stage')
            ->afterStateUpdated(function (Set $set, Get $get) {
                $this->updateDefects($this->stageId, $set); // <----- this fills the $defectListSchema property
            })
            ->reactive(),
    ])->columns(3),

Section::make('Defect List')
    ->schema(function () {
        return $this->defectListSchema;
    })
    ->hidden(function () {
        return $this->hideDefectList;
    }),
Section::make('AQL Report Form')
    ->schema([
        TextInput::make('limitCardNumber')
            ->label('Limit Card')
            ->disabled(true),
        TextInput::make('orderQuantity')
            ->label('Order Quantity')
            ->disabled(true),
        Select::make('stageId')
            ->options($this->stages)
            ->label('Stage')
            ->afterStateUpdated(function (Set $set, Get $get) {
                $this->updateDefects($this->stageId, $set); // <----- this fills the $defectListSchema property
            })
            ->reactive(),
    ])->columns(3),

Section::make('Defect List')
    ->schema(function () {
        return $this->defectListSchema;
    })
    ->hidden(function () {
        return $this->hideDefectList;
    }),


And the
$this->defectListSchema
$this->defectListSchema
contains many fields like this

Section::make('')->schema([
    TextInput::make('')->label('Defect')
        ->placeholder($defect['name'])
        ->disabled(true)
        ->columnSpan(2),
    TextInput::make('')->label('Inspection Level')
        ->placeholder($inspectionLevel->name)
        ->disabled(true),
    TextInput::make('')->label('Sample Size')
        ->placeholder($aqlLabel->sample)
        ->disabled(true),
    TextInput::make('numberOfDefects')
        ->numeric()
        ->label('Number of defects')
        ->afterStateUpdated(function (Set $set, Get $get) {
            // PTR compare and save data
        })
        ->reactive(),
])->columns(3),
Section::make('')->schema([
    TextInput::make('')->label('Defect')
        ->placeholder($defect['name'])
        ->disabled(true)
        ->columnSpan(2),
    TextInput::make('')->label('Inspection Level')
        ->placeholder($inspectionLevel->name)
        ->disabled(true),
    TextInput::make('')->label('Sample Size')
        ->placeholder($aqlLabel->sample)
        ->disabled(true),
    TextInput::make('numberOfDefects')
        ->numeric()
        ->label('Number of defects')
        ->afterStateUpdated(function (Set $set, Get $get) {
            // PTR compare and save data
        })
        ->reactive(),
])->columns(3),


But when i type anything in the
numberOfDefects
numberOfDefects
field that is reactive the entire form goes blank, disappears.

What could be the problem ?
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

Calling a Method Inside a Field Class in Filament v3 from JS
FilamentFFilament / ❓┊help
2y ago
Dynamic Form Inside Repeater isn't reactive
FilamentFFilament / ❓┊help
5mo ago
Filament v3 Wizard layout color schema.
FilamentFFilament / ❓┊help
3y ago
Reactive Builder field
FilamentFFilament / ❓┊help
3y ago