© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
Jigar D

In registration page, have dynamic steps for Wizard based of step's afterValidation

* If @domain.com is domain of an existing tenant, add the user to that
* Else send user to a "step 2" in the registration with 2 fields: Company / Team-name and Domain-name to set up a new Tenant.

    public function form(Form $form): Form
    {
        return $this->makeForm()
            ->schema([
                Wizard::make([
                    Wizard\Step::make('User Registration')
                        ->afterValidation(function () {
                            if ($someCondition) {
                              /* Get 2nd step and make hidden(false) */
                            }
                        })
                        ->description(__('Register as a Company Admin or as Regular User'))
                        ->schema([
                            $this->getNameFormComponent(),
                            $this->getLastNameFormComponent(),
                            $this->getEmailFormComponent(),
                            $this->getPasswordFormComponent(),
                            $this->getPasswordConfirmationFormComponent(),
                        ]),
                    Wizard\Step::make('Company Registration')
                        ->description(__('[Optional] For Company Admin'))
                        ->schema([
                            $this->getTenantFormComponent(),
                            $this->getDomainFormComponent(),
                        ]),
                ])->submitAction(new HtmlString(Blade::render(<<<BLADE
                    <x-filament::button
                        type="submit"
                        size="sm"
                    >
                        Submit
                    </x-filament::button>
                BLADE))),
            ])
            ->statePath('data');
    public function form(Form $form): Form
    {
        return $this->makeForm()
            ->schema([
                Wizard::make([
                    Wizard\Step::make('User Registration')
                        ->afterValidation(function () {
                            if ($someCondition) {
                              /* Get 2nd step and make hidden(false) */
                            }
                        })
                        ->description(__('Register as a Company Admin or as Regular User'))
                        ->schema([
                            $this->getNameFormComponent(),
                            $this->getLastNameFormComponent(),
                            $this->getEmailFormComponent(),
                            $this->getPasswordFormComponent(),
                            $this->getPasswordConfirmationFormComponent(),
                        ]),
                    Wizard\Step::make('Company Registration')
                        ->description(__('[Optional] For Company Admin'))
                        ->schema([
                            $this->getTenantFormComponent(),
                            $this->getDomainFormComponent(),
                        ]),
                ])->submitAction(new HtmlString(Blade::render(<<<BLADE
                    <x-filament::button
                        type="submit"
                        size="sm"
                    >
                        Submit
                    </x-filament::button>
                BLADE))),
            ])
            ->statePath('data');




I have tried
skippable()
skippable()
but that only provides option to switch between steps.

Thanks in advance.
Screenshot_2024-05-06_at_8.49.36_AM.png
Solution
Personally, I would not make it a Wizard, but rather a set of hidden/visible fields based on the domain. Unless that Company Registration is a huge form.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Dynamic Wizard Step
FilamentFFilament / ❓┊help
3y ago
Wizard: different steps based on value in step 1
FilamentFFilament / ❓┊help
2y ago
Wizard step afterValidation get only form fields of that step only
FilamentFFilament / ❓┊help
12mo ago
Possible bug: Wizard Step "afterValidation" Not being called
FilamentFFilament / ❓┊help
12mo ago