Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

marbobo's avatar
Level 12

filament form save button inside wizard step

Hello!

I have this form using a wizard https://ibb.co/zX6LBfd . I want to ask if it is possible that the save button is located inside the form wizard? maybe before the next button?

If so How can I do that? I can't find it in docs.. maybe you can give me link?

0 likes
3 replies
LaryAI's avatar
Level 58

To add a save button inside a wizard step in a Filament form, you can customize the wizard steps and include a save button within the step content. Here's a basic example of how you can achieve this:

  1. Create a Filament Form with Wizard Steps:

First, ensure you have a Filament form with wizard steps set up. Here's a basic example:

use Filament\Forms;
use Filament\Forms\Components\Wizard;
use Filament\Forms\Components\Wizard\Step;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Button;

class MyForm extends Forms\Component
{
    public function getFormSchema(): array
    {
        return [
            Wizard::make([
                Step::make('Step 1')
                    ->schema([
                        TextInput::make('name')
                            ->required(),
                        // Add a save button within the step
                        Button::make('Save')
                            ->action('save')
                            ->type('submit')
                            ->color('primary'),
                    ]),
                Step::make('Step 2')
                    ->schema([
                        TextInput::make('email')
                            ->required(),
                        // Add a save button within the step
                        Button::make('Save')
                            ->action('save')
                            ->type('submit')
                            ->color('primary'),
                    ]),
            ]),
        ];
    }

    public function save()
    {
        // Handle the save action
        $data = $this->form->getState();
        // Save the data to the database or perform other actions
    }
}
  1. Explanation:
  • Wizard::make: This creates the wizard component.
  • Step::make: This defines each step in the wizard.
  • TextInput::make: This adds a text input field to the form.
  • Button::make: This adds a button to the form. The action method specifies the method to call when the button is clicked. The type('submit') ensures the button submits the form.
  1. Save Method:

The save method is where you handle the form submission. You can access the form data using $this->form->getState() and then save it to the database or perform other actions as needed.

  1. Styling and Positioning:

You can further customize the styling and positioning of the button using Filament's built-in methods or by adding custom CSS classes.

This example should give you a good starting point for adding a save button within a wizard step in a Filament form. You can adjust the schema and actions according to your specific requirements.

marbobo's avatar
Level 12

@LaryAI did not work.. can you find the docs if there is something related to this?

1 like
aurawindsurfing's avatar

Hey @marbobo

No it is not possible. The reason for it is simply that if you look closer all that wizard does is that it breaks your form into steps but it is still one form just on multiple steps. So in other words it can only have one submit button at the end.

You can also test it by pressing enter on some intermediate steps and you will see that default form behaviour "submit" will happen and validation errors will be thrown for fields that were not filled in.

Please or to participate in this conversation.