FilamentF
Filament2y ago
MZX

Form not taking input when using disabled() on a field

Forms\Components\TextInput::make('amount')
                    ->disabled()
                    ->label('Amount (€)')
                    ->numeric(),


when I remove disabled, the record is being created, if I use disabled, get an error that the field is missing.
Solution
Disabled() removes the field from the form state. So, if you want to show it as a form input then you’ll need to make it either readonly or use dehydrated() like you have done. Or if the appearance is less vital then you can use a Placeholder field instead.
Was this page helpful?