Move "Save changes" button to sit between fields

Is it possible to render the form buttons "Save changes" and "Cancel" so they sit between 2 fields instead of bottom or top of form? I have my form which is made up of a text input, a code editor and a section that contains a fieldset which contains 3 checkbox lists. The check box lists are live so I'd like to put the save button before the section... any ideas? Cheers, Tee
Solution:
I think you could get this to work with Form Actions: https://filamentphp.com/docs/3.x/forms/actions#defining-a-form-component-action And something like this for the action? ...
Jump to solution
9 Replies
Dennis Koch
Dennis Kochβ€’4w ago
The check box lists are live so I'd like to put the save button before the section
Not sure why you want this because of live checkboxes? Because they aren't saved automatically either.
Solution
Dennis Koch
Dennis Kochβ€’4w ago
I think you could get this to work with Form Actions: https://filamentphp.com/docs/3.x/forms/actions#defining-a-form-component-action And something like this for the action?
->action(fn ($livewire) => $livewire->save())
->action(fn ($livewire) => $livewire->save())
TheRealTeeHill
TheRealTeeHillOPβ€’4w ago
I have maybe misrepresented my code a bit... its a mashup of my own thoughts and GPT so it may be a little flakey. Let me try to explain πŸ™‚ The checkboxes update a pivot table and checking and unchecking does not need the save button to be pressed for changes in the db to happen. I hope this helps shed light on my problem/desire to move the button, its not a big deal, just for UI purposes it makes a bit more sense to me to have the button after the code editor. Cheers
No description
Dennis Koch
Dennis Kochβ€’4w ago
Okay, makes sense if you immediately save the live checkboxes. Can you try my proposal above?
TheRealTeeHill
TheRealTeeHillOPβ€’4w ago
like this? apologies if I am way off because this give the following
No description
TheRealTeeHill
TheRealTeeHillOPβ€’4w ago
No description
TheRealTeeHill
TheRealTeeHillOPβ€’4w ago
that worked perfectly πŸ™ you don't happen to know the right method for cancel?
Dennis Koch
Dennis Kochβ€’4w ago
Cancel is probably just a redirect back.

Did you find this page helpful?