#Form action

5 messages · Page 1 of 1 (latest)

brittle lake
#

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

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');
    }
fossil spokeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

zinc latch
#

You probably need to run some JS manually through Livewire. Nothing that Filament supports out of the box.

naive ingot
#

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

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