Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

When I need to save data I need to click twice on submit button

On laravel 10 site having a form with several components of filamentphp 3 editor editing some input when I need to save data I need to click twice on submit button : a) on first click with mouse button is not clicked, but active input lose focus, so I need to click for the second time on submit button to submit the form b) But if I click out of input text firstly - so it lose focus, then next click on submit button run save function ok.

I have this feature in all my forms, say :

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('id')->disabled()->dehydrated(false)
                    ->hidden(fn(?Department $record) => $record === null),
                Select::make('manager_id')
                    ->preload()
                    ->options(Manager::query()->pluck('name', 'id'))
                    ->searchable(['name'])
                    ->required(),

                TextInput::make('name')->lazy()
                    ->required()
                    ->minLength(6)
                    ->maxLength(100)
                    ->hintColor('primary')
                    ->autofocus(),

                TextInput::make('created_at')
                    ->afterStateHydrated(function (TextInput $component, $state) {
                        $departmentModel = $component->getModelInstance();
                        $component->state(DateConv::getFormattedDateTime(
                            $departmentModel->getAttribute('created_at'),
                            \App\Enums\DatetimeOutputFormat::AS_TEXT
                        ));
                    })->disabled()
                    ->hidden(fn(?Department $record) => $record === null)
                    ->label('Created at'),

                TextInput::make('updated_at')
                    ->afterStateHydrated(function (TextInput $component, $state) {
                        $departmentModelModel = $component->getModelInstance();
                        $component->state(DateConv::getFormattedDateTime(
                            $departmentModelModel->getAttribute('updated_at'),
                            \App\Enums\DatetimeOutputFormat::AS_TEXT
                        ));
                    })->disabled()
                    ->hidden(fn(?Department $record
                    ) => ($record === null or $record->getAttribute('updated_at') === null))
                    ->label('Updated at'),
            ]);
    }

When user editing "name" field and tries to save the form. Maybe some options to configure it ? That is a bit confusing. Are there some options to run save function in a) case


"laravel/framework": "^10.28.0",
"filament/filament": "^3.0-stable",

Thanks in advance!

1 like
3 replies
awsqed's avatar

when the input is losing focus, it calls livewire/update, and disables the submit button until the call is finished, hence double click in order to submit i have to add a delay to overcome this issue

2 likes
awsqed's avatar
awsqed
Best Answer
Level 3

@PetroGromovo although filament said that you should not publish the vendor view and edit it but i cannot find any other solutions

you need to create resources/views/vendor/filament/components/button/index.blade.php

then open vendor/filament/support/resources/views/components/button/index.blade.php and copy its content to the file you created above

find line 211 or wire:loading.attr and replace it with wire:loading.attr.delay.long

im using filament 3.0.83 btw

3 likes

Please or to participate in this conversation.