#How to disable the button in Fileupload

2 messages · Page 1 of 1 (latest)

wanton meadow
#

what about this?

use Filament\Actions;

Actions\Action::make('import')
    ->form(fn (Actions\Action $action) => [
        FileUpload::make('excel_file')
            ->live()
            ->afterStateUpdated(function ($state) use ($action) {

                if ($state) {
                    $action
                        ->modalSubmitAction(fn (Actions\StaticAction $action) => $action
                            ->disabled(false)
                        );
                }
            }),
    ])
    ->modalSubmitAction(fn (Actions\StaticAction $action) => $action->disabled())
tired wraith
#

In addition to above solution you need to move your import logic into a job because right now all the processing is done on the backend side which blocking the response for large files