© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
52 replies
vas

field disabled on the edit page and hidden on the create new record page

hi i would like to have this field disabled on the edit page and hidden on the create new record page

                Forms\Components\TextInput::make('user_id')
                    ->required()
                    ->maxLength(255),
                Forms\Components\TextInput::make('user_id')
                    ->required()
                    ->maxLength(255),

any idea how could i accomplish this ? thank you
Solution
        return $form
            ->schema([
                Forms\Components\TextInput::make('location')
                    ->required()
                    ->maxLength(255),
                Forms\Components\Fieldset::make('User Information')
                    ->relationship('user', 'name')
                    ->schema([
                        Forms\Components\TextInput::make('name')
                            ->disabled(fn ($livewire) => $livewire instanceof EditRecord)
                    ])->hidden(fn ($livewire) => $livewire instanceof CreateRecord),
                Forms\Components\DatePicker::make('date')
                    ->required(),
                Forms\Components\TimePicker::make('time')
                    ->required(),
                Forms\Components\FileUpload::make('attachments')
                    ->image()
                    ->maxFiles(10)
                    ->multiple()->downloadable(),
                Forms\Components\Textarea::make('description')
                    ->required()
                    ->columnSpanFull(),
                Forms\Components\Textarea::make('corrective_action')
                    ->columnSpanFull(),
            ]);
    }
        return $form
            ->schema([
                Forms\Components\TextInput::make('location')
                    ->required()
                    ->maxLength(255),
                Forms\Components\Fieldset::make('User Information')
                    ->relationship('user', 'name')
                    ->schema([
                        Forms\Components\TextInput::make('name')
                            ->disabled(fn ($livewire) => $livewire instanceof EditRecord)
                    ])->hidden(fn ($livewire) => $livewire instanceof CreateRecord),
                Forms\Components\DatePicker::make('date')
                    ->required(),
                Forms\Components\TimePicker::make('time')
                    ->required(),
                Forms\Components\FileUpload::make('attachments')
                    ->image()
                    ->maxFiles(10)
                    ->multiple()->downloadable(),
                Forms\Components\Textarea::make('description')
                    ->required()
                    ->columnSpanFull(),
                Forms\Components\Textarea::make('corrective_action')
                    ->columnSpanFull(),
            ]);
    }
tweaked 😄
Jump to solution
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
Next page

Similar Threads

Edit Page not showing Hidden Field
FilamentFFilament / ❓┊help
3y ago
Hidden field works only while create and not edit
FilamentFFilament / ❓┊help
2y ago
hidden field depends on current page
FilamentFFilament / ❓┊help
2y ago
Eager load record on Edit Page
FilamentFFilament / ❓┊help
3y ago