F
Filamentβ€’2mo ago
GHOST-117

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 Kochβ€’2mo ago
You probably need to run some JS manually through Livewire. Nothing that Filament supports out of the box.
paresh singh
paresh singhβ€’2mo ago
got it ...doing this by dispatching an event πŸ™‚
Solution
GHOST-117
GHOST-117β€’2mo 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>
Want results from more Discord servers?
Add your server