Submit a form with a header Action on a custom page
Is it possible to use a headerAction to submit a form on a custom page?
I want to move the submit action to the top right of the page in the header.
but I don't know what the trick is to then submit the form with the button.
I have tried JS to submit the form but,
I assume that a JS submit doesn't work with wire:submit.
I have the following parts in my code:
in the Class:
protected function getHeaderActions(): array
{
return [
Action::make('save')->label('Opslaan')->keyBindings(['command+s', 'ctrl+s']),
];
public function form(Form $form): Form
{
return $form
->schema([...])
->statePath('data')
->model($this->course);
}
in the blade:
<x-filament-panels::page class="space-y-6">
<form wire:submit="save" class="space-y-6">
{{ $this->form }}
</form>
</x-filament-panels::page>
Solution:Jump to solution
Ok try this
```php
protected function getHeaderActions(): array
{
return [...
4 Replies
Try
On your action. If it doesn't work, try the following
Add an ID to your form
and then try this
Sorry, I haven't worked with custom pages in a long time, so something might be wrong, but I hope it helps ¯\_(ツ)_/¯
Thanks, But sadly it didn't work.
Solution
Ok try this
That did the trick, Thanks.