F
Filamentβ€’5mo ago
ByteXR

Wizard still showing "Next" when steps hidden dynamically

Hi there! I have an issue where I have 3 steps and 3rd step is either being shown or hidden depending on data from 1st step. It seems like step itself gets hidden successfully but "Next" action is still showing even if there is only 2 actions left. Anyone have any idea what am I doing wrong πŸ˜„ Thank you!
3 Replies
LeandroFerreira
LeandroFerreiraβ€’5mo ago
Please share some code
ByteXR
ByteXRβ€’5mo ago
Hidden::make('user_status')->default('available')->live(),
Wizard::make([
Step::make('User Email')
->schema([
...
])
->afterValidation(fn ($get, $set) => $this->checkUser($get('email'), $set)),
Step::make('Check & Details')
->schema([
...
]),
Step::make('Confirm')
->schema([
...
])
->visible(fn (Get $get): bool => $get('user_status') === 'available')
])
->columnSpan(2)
Hidden::make('user_status')->default('available')->live(),
Wizard::make([
Step::make('User Email')
->schema([
...
])
->afterValidation(fn ($get, $set) => $this->checkUser($get('email'), $set)),
Step::make('Check & Details')
->schema([
...
]),
Step::make('Confirm')
->schema([
...
])
->visible(fn (Get $get): bool => $get('user_status') === 'available')
])
->columnSpan(2)
checkUser method just set user_status depending on some checks, that bit works as step is being hidden, the only thing that stays is "Next" button instead of submit
Ander
Anderβ€’5mo ago
I have a same issue
protected function getSteps(): array
{
return
[
Step::make(__('bonuses.create.bonus_name'))
->schema(
BonusesResource::getFormSchema('0')
),
Step::make(__('bonuses.create.add_employees'))
->hidden(fn (Get $get) => empty($get('applies_to_all_employees')) ? false : true)
->schema([
]),
];
}
protected function getSteps(): array
{
return
[
Step::make(__('bonuses.create.bonus_name'))
->schema(
BonusesResource::getFormSchema('0')
),
Step::make(__('bonuses.create.add_employees'))
->hidden(fn (Get $get) => empty($get('applies_to_all_employees')) ? false : true)
->schema([
]),
];
}