Form action

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

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');
}
Solution:
``` <script> document.addEventListener('DOMContentLoaded', function() { Livewire.on('openInNewTab', url => { window.open(url, '_blank');...
Jump to solution
3 Replies
Dennis Koch
Dennis Koch3mo ago
You probably need to run some JS manually through Livewire. Nothing that Filament supports out of the box.
paresh singh
paresh singh3mo ago
got it ...doing this by dispatching an event 🙂
Solution
GHOST-117
GHOST-1173mo ago
<script>
document.addEventListener('DOMContentLoaded', function() {
Livewire.on('openInNewTab', url => {
window.open(url, '_blank');
});
})
</script>
<script>
document.addEventListener('DOMContentLoaded', function() {
Livewire.on('openInNewTab', url => {
window.open(url, '_blank');
});
})
</script>

Did you find this page helpful?