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

devhoussam123's avatar

Filament Forms & Actions: How to open to external URL with new browser tab after a form has been filled

Once the form been filled and the user click to submit action I want to open an external URL with new browser tab.

Code Snippet:

<?php

namespace App\Filament\App\Pages;

...

class Search extends Page
{
    use InteractsWithFormActions;

    public ?array $data = [];

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')
                    ->placeholder(__('e.g. Oliver Queen'))
                    ->autofocus(),
            ])
            ->statePath('data');
    }

    public function submit(): void
    {
        $data = $this->form->getState();
    }

    public function getSubmitFormAction(): Action
    {
        return Action::make('submit')
            ->label(__('Submit'))
            ->color('primary')
            ->action('submit');
    }
}
0 likes
1 reply
GHOST117s's avatar

got it ...doing this by dispatching an event 🙂

<script>
        document.addEventListener('DOMContentLoaded', function() {
            Livewire.on('openInNewTab', url => {
                window.open(url, '_blank');
            });
        })
    </script>

Please or to participate in this conversation.