Action Buttons on Top of Page

It's convenient to have a copy of the "Save Changes" and "Cancel" button on the top of the page if you have a long form. Can we do this?
5 Replies
Dan Harrin
Dan Harrin2y ago
yes, have you tried?
binaryruel
binaryruelOP2y ago
Thanks Dan! I did it by overriding the render method and copying the edit-record and adding another form actions above the form.
...
<x-filament::form wire:submit.prevent="save">

<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>

{{ $this->form }}

<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
</x-filament::form>
...
...
<x-filament::form wire:submit.prevent="save">

<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>

{{ $this->form }}

<x-filament::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()"
/>
</x-filament::form>
...
and in my EditRecord class
public function render(): View
{
return view('my-blade-view', $this->getViewData())
->layout(static::$layout, $this->getLayoutData());
}
public function render(): View
{
return view('my-blade-view', $this->getViewData())
->layout(static::$layout, $this->getLayoutData());
}
Let me know if that's the easiest way.
awcodes
awcodes2y ago
I wouldn’t over ride the view. You can use the getPageActions() method to add actions to the top of the page. Pretty sure it’s in the docs.
Dan Harrin
Dan Harrin2y ago
getActions()
awcodes
awcodes2y ago
Yea. What Dan said.
Want results from more Discord servers?
Add your server